summaryrefslogtreecommitdiff
path: root/vendor/nikic/php-parser/lib/PhpParser/Builder
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2022-03-22 12:24:31 +0300
committerAndrew Dolgov <[email protected]>2022-03-22 12:24:31 +0300
commit1c4f7ab3b838b23afb2ee4dab14acbf75956e952 (patch)
tree0a19274107d717efe92d2c0376cd3105fead5a11 /vendor/nikic/php-parser/lib/PhpParser/Builder
parent711662948768492e8d05b778a7d80eacaec368d2 (diff)
* add phpunit as a dev dependency
* add some basic tests for UrlHelper::rewrite_relative() * fix UrlHelper::rewrite_relative() to work better on non-absolute relative URL paths
Diffstat (limited to 'vendor/nikic/php-parser/lib/PhpParser/Builder')
-rw-r--r--vendor/nikic/php-parser/lib/PhpParser/Builder/ClassConst.php132
-rw-r--r--vendor/nikic/php-parser/lib/PhpParser/Builder/Class_.php140
-rw-r--r--vendor/nikic/php-parser/lib/PhpParser/Builder/Declaration.php43
-rw-r--r--vendor/nikic/php-parser/lib/PhpParser/Builder/EnumCase.php85
-rw-r--r--vendor/nikic/php-parser/lib/PhpParser/Builder/Enum_.php117
-rw-r--r--vendor/nikic/php-parser/lib/PhpParser/Builder/FunctionLike.php73
-rw-r--r--vendor/nikic/php-parser/lib/PhpParser/Builder/Function_.php67
-rw-r--r--vendor/nikic/php-parser/lib/PhpParser/Builder/Interface_.php93
-rw-r--r--vendor/nikic/php-parser/lib/PhpParser/Builder/Method.php146
-rw-r--r--vendor/nikic/php-parser/lib/PhpParser/Builder/Namespace_.php45
-rw-r--r--vendor/nikic/php-parser/lib/PhpParser/Builder/Param.php122
-rw-r--r--vendor/nikic/php-parser/lib/PhpParser/Builder/Property.php161
-rw-r--r--vendor/nikic/php-parser/lib/PhpParser/Builder/TraitUse.php64
-rw-r--r--vendor/nikic/php-parser/lib/PhpParser/Builder/TraitUseAdaptation.php148
-rw-r--r--vendor/nikic/php-parser/lib/PhpParser/Builder/Trait_.php78
-rw-r--r--vendor/nikic/php-parser/lib/PhpParser/Builder/Use_.php49
16 files changed, 1563 insertions, 0 deletions
diff --git a/vendor/nikic/php-parser/lib/PhpParser/Builder/ClassConst.php b/vendor/nikic/php-parser/lib/PhpParser/Builder/ClassConst.php
new file mode 100644
index 000000000..f616c6270
--- /dev/null
+++ b/vendor/nikic/php-parser/lib/PhpParser/Builder/ClassConst.php
@@ -0,0 +1,132 @@
+<?php
+
+declare(strict_types=1);
+
+namespace PhpParser\Builder;
+
+use PhpParser;
+use PhpParser\BuilderHelpers;
+use PhpParser\Node;
+use PhpParser\Node\Const_;
+use PhpParser\Node\Identifier;
+use PhpParser\Node\Stmt;
+
+class ClassConst implements PhpParser\Builder
+{
+ protected $flags = 0;
+ protected $attributes = [];
+ protected $constants = [];
+
+ /** @var Node\AttributeGroup[] */
+ protected $attributeGroups = [];
+
+ /**
+ * Creates a class constant builder
+ *
+ * @param string|Identifier $name Name
+ * @param Node\Expr|bool|null|int|float|string|array $value Value
+ */
+ public function __construct($name, $value) {
+ $this->constants = [new Const_($name, BuilderHelpers::normalizeValue($value))];
+ }
+
+ /**
+ * Add another constant to const group
+ *
+ * @param string|Identifier $name Name
+ * @param Node\Expr|bool|null|int|float|string|array $value Value
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function addConst($name, $value) {
+ $this->constants[] = new Const_($name, BuilderHelpers::normalizeValue($value));
+
+ return $this;
+ }
+
+ /**
+ * Makes the constant public.
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function makePublic() {
+ $this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_PUBLIC);
+
+ return $this;
+ }
+
+ /**
+ * Makes the constant protected.
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function makeProtected() {
+ $this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_PROTECTED);
+
+ return $this;
+ }
+
+ /**
+ * Makes the constant private.
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function makePrivate() {
+ $this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_PRIVATE);
+
+ return $this;
+ }
+
+ /**
+ * Makes the constant final.
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function makeFinal() {
+ $this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_FINAL);
+
+ return $this;
+ }
+
+ /**
+ * Sets doc comment for the constant.
+ *
+ * @param PhpParser\Comment\Doc|string $docComment Doc comment to set
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function setDocComment($docComment) {
+ $this->attributes = [
+ 'comments' => [BuilderHelpers::normalizeDocComment($docComment)]
+ ];
+
+ return $this;
+ }
+
+ /**
+ * Adds an attribute group.
+ *
+ * @param Node\Attribute|Node\AttributeGroup $attribute
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function addAttribute($attribute) {
+ $this->attributeGroups[] = BuilderHelpers::normalizeAttribute($attribute);
+
+ return $this;
+ }
+
+ /**
+ * Returns the built class node.
+ *
+ * @return Stmt\ClassConst The built constant node
+ */
+ public function getNode(): PhpParser\Node {
+ return new Stmt\ClassConst(
+ $this->constants,
+ $this->flags,
+ $this->attributes,
+ $this->attributeGroups
+ );
+ }
+}
diff --git a/vendor/nikic/php-parser/lib/PhpParser/Builder/Class_.php b/vendor/nikic/php-parser/lib/PhpParser/Builder/Class_.php
new file mode 100644
index 000000000..87e2901a9
--- /dev/null
+++ b/vendor/nikic/php-parser/lib/PhpParser/Builder/Class_.php
@@ -0,0 +1,140 @@
+<?php declare(strict_types=1);
+
+namespace PhpParser\Builder;
+
+use PhpParser;
+use PhpParser\BuilderHelpers;
+use PhpParser\Node;
+use PhpParser\Node\Name;
+use PhpParser\Node\Stmt;
+
+class Class_ extends Declaration
+{
+ protected $name;
+
+ protected $extends = null;
+ protected $implements = [];
+ protected $flags = 0;
+
+ protected $uses = [];
+ protected $constants = [];
+ protected $properties = [];
+ protected $methods = [];
+
+ /** @var Node\AttributeGroup[] */
+ protected $attributeGroups = [];
+
+ /**
+ * Creates a class builder.
+ *
+ * @param string $name Name of the class
+ */
+ public function __construct(string $name) {
+ $this->name = $name;
+ }
+
+ /**
+ * Extends a class.
+ *
+ * @param Name|string $class Name of class to extend
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function extend($class) {
+ $this->extends = BuilderHelpers::normalizeName($class);
+
+ return $this;
+ }
+
+ /**
+ * Implements one or more interfaces.
+ *
+ * @param Name|string ...$interfaces Names of interfaces to implement
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function implement(...$interfaces) {
+ foreach ($interfaces as $interface) {
+ $this->implements[] = BuilderHelpers::normalizeName($interface);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Makes the class abstract.
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function makeAbstract() {
+ $this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_ABSTRACT);
+
+ return $this;
+ }
+
+ /**
+ * Makes the class final.
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function makeFinal() {
+ $this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_FINAL);
+
+ return $this;
+ }
+
+ /**
+ * Adds a statement.
+ *
+ * @param Stmt|PhpParser\Builder $stmt The statement to add
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function addStmt($stmt) {
+ $stmt = BuilderHelpers::normalizeNode($stmt);
+
+ $targets = [
+ Stmt\TraitUse::class => &$this->uses,
+ Stmt\ClassConst::class => &$this->constants,
+ Stmt\Property::class => &$this->properties,
+ Stmt\ClassMethod::class => &$this->methods,
+ ];
+
+ $class = \get_class($stmt);
+ if (!isset($targets[$class])) {
+ throw new \LogicException(sprintf('Unexpected node of type "%s"', $stmt->getType()));
+ }
+
+ $targets[$class][] = $stmt;
+
+ return $this;
+ }
+
+ /**
+ * Adds an attribute group.
+ *
+ * @param Node\Attribute|Node\AttributeGroup $attribute
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function addAttribute($attribute) {
+ $this->attributeGroups[] = BuilderHelpers::normalizeAttribute($attribute);
+
+ return $this;
+ }
+
+ /**
+ * Returns the built class node.
+ *
+ * @return Stmt\Class_ The built class node
+ */
+ public function getNode() : PhpParser\Node {
+ return new Stmt\Class_($this->name, [
+ 'flags' => $this->flags,
+ 'extends' => $this->extends,
+ 'implements' => $this->implements,
+ 'stmts' => array_merge($this->uses, $this->constants, $this->properties, $this->methods),
+ 'attrGroups' => $this->attributeGroups,
+ ], $this->attributes);
+ }
+}
diff --git a/vendor/nikic/php-parser/lib/PhpParser/Builder/Declaration.php b/vendor/nikic/php-parser/lib/PhpParser/Builder/Declaration.php
new file mode 100644
index 000000000..830949928
--- /dev/null
+++ b/vendor/nikic/php-parser/lib/PhpParser/Builder/Declaration.php
@@ -0,0 +1,43 @@
+<?php declare(strict_types=1);
+
+namespace PhpParser\Builder;
+
+use PhpParser;
+use PhpParser\BuilderHelpers;
+
+abstract class Declaration implements PhpParser\Builder
+{
+ protected $attributes = [];
+
+ abstract public function addStmt($stmt);
+
+ /**
+ * Adds multiple statements.
+ *
+ * @param array $stmts The statements to add
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function addStmts(array $stmts) {
+ foreach ($stmts as $stmt) {
+ $this->addStmt($stmt);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Sets doc comment for the declaration.
+ *
+ * @param PhpParser\Comment\Doc|string $docComment Doc comment to set
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function setDocComment($docComment) {
+ $this->attributes['comments'] = [
+ BuilderHelpers::normalizeDocComment($docComment)
+ ];
+
+ return $this;
+ }
+}
diff --git a/vendor/nikic/php-parser/lib/PhpParser/Builder/EnumCase.php b/vendor/nikic/php-parser/lib/PhpParser/Builder/EnumCase.php
new file mode 100644
index 000000000..02fa83e62
--- /dev/null
+++ b/vendor/nikic/php-parser/lib/PhpParser/Builder/EnumCase.php
@@ -0,0 +1,85 @@
+<?php
+
+declare(strict_types=1);
+
+namespace PhpParser\Builder;
+
+use PhpParser;
+use PhpParser\BuilderHelpers;
+use PhpParser\Node;
+use PhpParser\Node\Identifier;
+use PhpParser\Node\Stmt;
+
+class EnumCase implements PhpParser\Builder
+{
+ protected $name;
+ protected $value = null;
+ protected $attributes = [];
+
+ /** @var Node\AttributeGroup[] */
+ protected $attributeGroups = [];
+
+ /**
+ * Creates an enum case builder.
+ *
+ * @param string|Identifier $name Name
+ */
+ public function __construct($name) {
+ $this->name = $name;
+ }
+
+ /**
+ * Sets the value.
+ *
+ * @param Node\Expr|string|int $value
+ *
+ * @return $this
+ */
+ public function setValue($value) {
+ $this->value = BuilderHelpers::normalizeValue($value);
+
+ return $this;
+ }
+
+ /**
+ * Sets doc comment for the constant.
+ *
+ * @param PhpParser\Comment\Doc|string $docComment Doc comment to set
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function setDocComment($docComment) {
+ $this->attributes = [
+ 'comments' => [BuilderHelpers::normalizeDocComment($docComment)]
+ ];
+
+ return $this;
+ }
+
+ /**
+ * Adds an attribute group.
+ *
+ * @param Node\Attribute|Node\AttributeGroup $attribute
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function addAttribute($attribute) {
+ $this->attributeGroups[] = BuilderHelpers::normalizeAttribute($attribute);
+
+ return $this;
+ }
+
+ /**
+ * Returns the built enum case node.
+ *
+ * @return Stmt\EnumCase The built constant node
+ */
+ public function getNode(): PhpParser\Node {
+ return new Stmt\EnumCase(
+ $this->name,
+ $this->value,
+ $this->attributes,
+ $this->attributeGroups
+ );
+ }
+}
diff --git a/vendor/nikic/php-parser/lib/PhpParser/Builder/Enum_.php b/vendor/nikic/php-parser/lib/PhpParser/Builder/Enum_.php
new file mode 100644
index 000000000..be7eef95f
--- /dev/null
+++ b/vendor/nikic/php-parser/lib/PhpParser/Builder/Enum_.php
@@ -0,0 +1,117 @@
+<?php declare(strict_types=1);
+
+namespace PhpParser\Builder;
+
+use PhpParser;
+use PhpParser\BuilderHelpers;
+use PhpParser\Node;
+use PhpParser\Node\Identifier;
+use PhpParser\Node\Name;
+use PhpParser\Node\Stmt;
+
+class Enum_ extends Declaration
+{
+ protected $name;
+ protected $scalarType = null;
+
+ protected $implements = [];
+
+ protected $uses = [];
+ protected $enumCases = [];
+ protected $constants = [];
+ protected $methods = [];
+
+ /** @var Node\AttributeGroup[] */
+ protected $attributeGroups = [];
+
+ /**
+ * Creates an enum builder.
+ *
+ * @param string $name Name of the enum
+ */
+ public function __construct(string $name) {
+ $this->name = $name;
+ }
+
+ /**
+ * Sets the scalar type.
+ *
+ * @param string|Identifier $type
+ *
+ * @return $this
+ */
+ public function setScalarType($scalarType) {
+ $this->scalarType = BuilderHelpers::normalizeType($scalarType);
+
+ return $this;
+ }
+
+ /**
+ * Implements one or more interfaces.
+ *
+ * @param Name|string ...$interfaces Names of interfaces to implement
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function implement(...$interfaces) {
+ foreach ($interfaces as $interface) {
+ $this->implements[] = BuilderHelpers::normalizeName($interface);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Adds a statement.
+ *
+ * @param Stmt|PhpParser\Builder $stmt The statement to add
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function addStmt($stmt) {
+ $stmt = BuilderHelpers::normalizeNode($stmt);
+
+ $targets = [
+ Stmt\TraitUse::class => &$this->uses,
+ Stmt\EnumCase::class => &$this->enumCases,
+ Stmt\ClassConst::class => &$this->constants,
+ Stmt\ClassMethod::class => &$this->methods,
+ ];
+
+ $class = \get_class($stmt);
+ if (!isset($targets[$class])) {
+ throw new \LogicException(sprintf('Unexpected node of type "%s"', $stmt->getType()));
+ }
+
+ $targets[$class][] = $stmt;
+
+ return $this;
+ }
+
+ /**
+ * Adds an attribute group.
+ *
+ * @param Node\Attribute|Node\AttributeGroup $attribute
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function addAttribute($attribute) {
+ $this->attributeGroups[] = BuilderHelpers::normalizeAttribute($attribute);
+
+ return $this;
+ }
+
+ /**
+ * Returns the built class node.
+ *
+ * @return Stmt\Enum_ The built enum node
+ */
+ public function getNode() : PhpParser\Node {
+ return new Stmt\Enum_($this->name, [
+ 'scalarType' => $this->scalarType,
+ 'implements' => $this->implements,
+ 'stmts' => array_merge($this->uses, $this->enumCases, $this->constants, $this->methods),
+ 'attrGroups' => $this->attributeGroups,
+ ], $this->attributes);
+ }
+}
diff --git a/vendor/nikic/php-parser/lib/PhpParser/Builder/FunctionLike.php b/vendor/nikic/php-parser/lib/PhpParser/Builder/FunctionLike.php
new file mode 100644
index 000000000..98ea9d336
--- /dev/null
+++ b/vendor/nikic/php-parser/lib/PhpParser/Builder/FunctionLike.php
@@ -0,0 +1,73 @@
+<?php declare(strict_types=1);
+
+namespace PhpParser\Builder;
+
+use PhpParser\BuilderHelpers;
+use PhpParser\Node;
+
+abstract class FunctionLike extends Declaration
+{
+ protected $returnByRef = false;
+ protected $params = [];
+
+ /** @var string|Node\Name|Node\NullableType|null */
+ protected $returnType = null;
+
+ /**
+ * Make the function return by reference.
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function makeReturnByRef() {
+ $this->returnByRef = true;
+
+ return $this;
+ }
+
+ /**
+ * Adds a parameter.
+ *
+ * @param Node\Param|Param $param The parameter to add
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function addParam($param) {
+ $param = BuilderHelpers::normalizeNode($param);
+
+ if (!$param instanceof Node\Param) {
+ throw new \LogicException(sprintf('Expected parameter node, got "%s"', $param->getType()));
+ }
+
+ $this->params[] = $param;
+
+ return $this;
+ }
+
+ /**
+ * Adds multiple parameters.
+ *
+ * @param array $params The parameters to add
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function addParams(array $params) {
+ foreach ($params as $param) {
+ $this->addParam($param);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Sets the return type for PHP 7.
+ *
+ * @param string|Node\Name|Node\Identifier|Node\ComplexType $type
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function setReturnType($type) {
+ $this->returnType = BuilderHelpers::normalizeType($type);
+
+ return $this;
+ }
+}
diff --git a/vendor/nikic/php-parser/lib/PhpParser/Builder/Function_.php b/vendor/nikic/php-parser/lib/PhpParser/Builder/Function_.php
new file mode 100644
index 000000000..1cd73c0d3
--- /dev/null
+++ b/vendor/nikic/php-parser/lib/PhpParser/Builder/Function_.php
@@ -0,0 +1,67 @@
+<?php declare(strict_types=1);
+
+namespace PhpParser\Builder;
+
+use PhpParser;
+use PhpParser\BuilderHelpers;
+use PhpParser\Node;
+use PhpParser\Node\Stmt;
+
+class Function_ extends FunctionLike
+{
+ protected $name;
+ protected $stmts = [];
+
+ /** @var Node\AttributeGroup[] */
+ protected $attributeGroups = [];
+
+ /**
+ * Creates a function builder.
+ *
+ * @param string $name Name of the function
+ */
+ public function __construct(string $name) {
+ $this->name = $name;
+ }
+
+ /**
+ * Adds a statement.
+ *
+ * @param Node|PhpParser\Builder $stmt The statement to add
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function addStmt($stmt) {
+ $this->stmts[] = BuilderHelpers::normalizeStmt($stmt);
+
+ return $this;
+ }
+
+ /**
+ * Adds an attribute group.
+ *
+ * @param Node\Attribute|Node\AttributeGroup $attribute
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function addAttribute($attribute) {
+ $this->attributeGroups[] = BuilderHelpers::normalizeAttribute($attribute);
+
+ return $this;
+ }
+
+ /**
+ * Returns the built function node.
+ *
+ * @return Stmt\Function_ The built function node
+ */
+ public function getNode() : Node {
+ return new Stmt\Function_($this->name, [
+ 'byRef' => $this->returnByRef,
+ 'params' => $this->params,
+ 'returnType' => $this->returnType,
+ 'stmts' => $this->stmts,
+ 'attrGroups' => $this->attributeGroups,
+ ], $this->attributes);
+ }
+}
diff --git a/vendor/nikic/php-parser/lib/PhpParser/Builder/Interface_.php b/vendor/nikic/php-parser/lib/PhpParser/Builder/Interface_.php
new file mode 100644
index 000000000..7806e85fc
--- /dev/null
+++ b/vendor/nikic/php-parser/lib/PhpParser/Builder/Interface_.php
@@ -0,0 +1,93 @@
+<?php declare(strict_types=1);
+
+namespace PhpParser\Builder;
+
+use PhpParser;
+use PhpParser\BuilderHelpers;
+use PhpParser\Node;
+use PhpParser\Node\Name;
+use PhpParser\Node\Stmt;
+
+class Interface_ extends Declaration
+{
+ protected $name;
+ protected $extends = [];
+ protected $constants = [];
+ protected $methods = [];
+
+ /** @var Node\AttributeGroup[] */
+ protected $attributeGroups = [];
+
+ /**
+ * Creates an interface builder.
+ *
+ * @param string $name Name of the interface
+ */
+ public function __construct(string $name) {
+ $this->name = $name;
+ }
+
+ /**
+ * Extends one or more interfaces.
+ *
+ * @param Name|string ...$interfaces Names of interfaces to extend
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function extend(...$interfaces) {
+ foreach ($interfaces as $interface) {
+ $this->extends[] = BuilderHelpers::normalizeName($interface);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Adds a statement.
+ *
+ * @param Stmt|PhpParser\Builder $stmt The statement to add
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function addStmt($stmt) {
+ $stmt = BuilderHelpers::normalizeNode($stmt);
+
+ if ($stmt instanceof Stmt\ClassConst) {
+ $this->constants[] = $stmt;
+ } elseif ($stmt instanceof Stmt\ClassMethod) {
+ // we erase all statements in the body of an interface method
+ $stmt->stmts = null;
+ $this->methods[] = $stmt;
+ } else {
+ throw new \LogicException(sprintf('Unexpected node of type "%s"', $stmt->getType()));
+ }
+
+ return $this;
+ }
+
+ /**
+ * Adds an attribute group.
+ *
+ * @param Node\Attribute|Node\AttributeGroup $attribute
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function addAttribute($attribute) {
+ $this->attributeGroups[] = BuilderHelpers::normalizeAttribute($attribute);
+
+ return $this;
+ }
+
+ /**
+ * Returns the built interface node.
+ *
+ * @return Stmt\Interface_ The built interface node
+ */
+ public function getNode() : PhpParser\Node {
+ return new Stmt\Interface_($this->name, [
+ 'extends' => $this->extends,
+ 'stmts' => array_merge($this->constants, $this->methods),
+ 'attrGroups' => $this->attributeGroups,
+ ], $this->attributes);
+ }
+}
diff --git a/vendor/nikic/php-parser/lib/PhpParser/Builder/Method.php b/vendor/nikic/php-parser/lib/PhpParser/Builder/Method.php
new file mode 100644
index 000000000..232d7cb87
--- /dev/null
+++ b/vendor/nikic/php-parser/lib/PhpParser/Builder/Method.php
@@ -0,0 +1,146 @@
+<?php declare(strict_types=1);
+
+namespace PhpParser\Builder;
+
+use PhpParser;
+use PhpParser\BuilderHelpers;
+use PhpParser\Node;
+use PhpParser\Node\Stmt;
+
+class Method extends FunctionLike
+{
+ protected $name;
+ protected $flags = 0;
+
+ /** @var array|null */
+ protected $stmts = [];
+
+ /** @var Node\AttributeGroup[] */
+ protected $attributeGroups = [];
+
+ /**
+ * Creates a method builder.
+ *
+ * @param string $name Name of the method
+ */
+ public function __construct(string $name) {
+ $this->name = $name;
+ }
+
+ /**
+ * Makes the method public.
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function makePublic() {
+ $this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_PUBLIC);
+
+ return $this;
+ }
+
+ /**
+ * Makes the method protected.
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function makeProtected() {
+ $this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_PROTECTED);
+
+ return $this;
+ }
+
+ /**
+ * Makes the method private.
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function makePrivate() {
+ $this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_PRIVATE);
+
+ return $this;
+ }
+
+ /**
+ * Makes the method static.
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function makeStatic() {
+ $this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_STATIC);
+
+ return $this;
+ }
+
+ /**
+ * Makes the method abstract.
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function makeAbstract() {
+ if (!empty($this->stmts)) {
+ throw new \LogicException('Cannot make method with statements abstract');
+ }
+
+ $this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_ABSTRACT);
+ $this->stmts = null; // abstract methods don't have statements
+
+ return $this;
+ }
+
+ /**
+ * Makes the method final.
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function makeFinal() {
+ $this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_FINAL);
+
+ return $this;
+ }
+
+ /**
+ * Adds a statement.
+ *
+ * @param Node|PhpParser\Builder $stmt The statement to add
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function addStmt($stmt) {
+ if (null === $this->stmts) {
+ throw new \LogicException('Cannot add statements to an abstract method');
+ }
+
+ $this->stmts[] = BuilderHelpers::normalizeStmt($stmt);
+
+ return $this;
+ }
+
+ /**
+ * Adds an attribute group.
+ *
+ * @param Node\Attribute|Node\AttributeGroup $attribute
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function addAttribute($attribute) {
+ $this->attributeGroups[] = BuilderHelpers::normalizeAttribute($attribute);
+
+ return $this;
+ }
+
+ /**
+ * Returns the built method node.
+ *
+ * @return Stmt\ClassMethod The built method node
+ */
+ public function getNode() : Node {
+ return new Stmt\ClassMethod($this->name, [
+ 'flags' => $this->flags,
+ 'byRef' => $this->returnByRef,
+ 'params' => $this->params,
+ 'returnType' => $this->returnType,
+ 'stmts' => $this->stmts,
+ 'attrGroups' => $this->attributeGroups,
+ ], $this->attributes);
+ }
+}
diff --git a/vendor/nikic/php-parser/lib/PhpParser/Builder/Namespace_.php b/vendor/nikic/php-parser/lib/PhpParser/Builder/Namespace_.php
new file mode 100644
index 000000000..1c751e163
--- /dev/null
+++ b/vendor/nikic/php-parser/lib/PhpParser/Builder/Namespace_.php
@@ -0,0 +1,45 @@
+<?php declare(strict_types=1);
+
+namespace PhpParser\Builder;
+
+use PhpParser;
+use PhpParser\BuilderHelpers;
+use PhpParser\Node;
+use PhpParser\Node\Stmt;
+
+class Namespace_ extends Declaration
+{
+ private $name;
+ private $stmts = [];
+
+ /**
+ * Creates a namespace builder.
+ *
+ * @param Node\Name|string|null $name Name of the namespace
+ */
+ public function __construct($name) {
+ $this->name = null !== $name ? BuilderHelpers::normalizeName($name) : null;
+ }
+
+ /**
+ * Adds a statement.
+ *
+ * @param Node|PhpParser\Builder $stmt The statement to add
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function addStmt($stmt) {
+ $this->stmts[] = BuilderHelpers::normalizeStmt($stmt);
+
+ return $this;
+ }
+
+ /**
+ * Returns the built node.
+ *
+ * @return Stmt\Namespace_ The built node
+ */
+ public function getNode() : Node {
+ return new Stmt\Namespace_($this->name, $this->stmts, $this->attributes);
+ }
+}
diff --git a/vendor/nikic/php-parser/lib/PhpParser/Builder/Param.php b/vendor/nikic/php-parser/lib/PhpParser/Builder/Param.php
new file mode 100644
index 000000000..de9aae7e5
--- /dev/null
+++ b/vendor/nikic/php-parser/lib/PhpParser/Builder/Param.php
@@ -0,0 +1,122 @@
+<?php declare(strict_types=1);
+
+namespace PhpParser\Builder;
+
+use PhpParser;
+use PhpParser\BuilderHelpers;
+use PhpParser\Node;
+
+class Param implements PhpParser\Builder
+{
+ protected $name;
+
+ protected $default = null;
+
+ /** @var Node\Identifier|Node\Name|Node\NullableType|null */
+ protected $type = null;
+
+ protected $byRef = false;
+
+ protected $variadic = false;
+
+ /** @var Node\AttributeGroup[] */
+ protected $attributeGroups = [];
+
+ /**
+ * Creates a parameter builder.
+ *
+ * @param string $name Name of the parameter
+ */
+ public function __construct(string $name) {
+ $this->name = $name;
+ }
+
+ /**
+ * Sets default value for the parameter.
+ *
+ * @param mixed $value Default value to use
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function setDefault($value) {
+ $this->default = BuilderHelpers::normalizeValue($value);
+
+ return $this;
+ }
+
+ /**
+ * Sets type for the parameter.
+ *
+ * @param string|Node\Name|Node\Identifier|Node\ComplexType $type Parameter type
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function setType($type) {
+ $this->type = BuilderHelpers::normalizeType($type);
+ if ($this->type == 'void') {
+ throw new \LogicException('Parameter type cannot be void');
+ }
+
+ return $this;
+ }
+
+ /**
+ * Sets type for the parameter.
+ *
+ * @param string|Node\Name|Node\Identifier|Node\ComplexType $type Parameter type
+ *
+ * @return $this The builder instance (for fluid interface)
+ *
+ * @deprecated Use setType() instead
+ */
+ public function setTypeHint($type) {
+ return $this->setType($type);
+ }
+
+ /**
+ * Make the parameter accept the value by reference.
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function makeByRef() {
+ $this->byRef = true;
+
+ return $this;
+ }
+
+ /**
+ * Make the parameter variadic
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function makeVariadic() {
+ $this->variadic = true;
+
+ return $this;
+ }
+
+ /**
+ * Adds an attribute group.
+ *
+ * @param Node\Attribute|Node\AttributeGroup $attribute
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function addAttribute($attribute) {
+ $this->attributeGroups[] = BuilderHelpers::normalizeAttribute($attribute);
+
+ return $this;
+ }
+
+ /**
+ * Returns the built parameter node.
+ *
+ * @return Node\Param The built parameter node
+ */
+ public function getNode() : Node {
+ return new Node\Param(
+ new Node\Expr\Variable($this->name),
+ $this->default, $this->type, $this->byRef, $this->variadic, [], 0, $this->attributeGroups
+ );
+ }
+}
diff --git a/vendor/nikic/php-parser/lib/PhpParser/Builder/Property.php b/vendor/nikic/php-parser/lib/PhpParser/Builder/Property.php
new file mode 100644
index 000000000..68e318565
--- /dev/null
+++ b/vendor/nikic/php-parser/lib/PhpParser/Builder/Property.php
@@ -0,0 +1,161 @@
+<?php declare(strict_types=1);
+
+namespace PhpParser\Builder;
+
+use PhpParser;
+use PhpParser\BuilderHelpers;
+use PhpParser\Node;
+use PhpParser\Node\Identifier;
+use PhpParser\Node\Name;
+use PhpParser\Node\Stmt;
+use PhpParser\Node\ComplexType;
+
+class Property implements PhpParser\Builder
+{
+ protected $name;
+
+ protected $flags = 0;
+ protected $default = null;
+ protected $attributes = [];
+
+ /** @var null|Identifier|Name|NullableType */
+ protected $type;
+
+ /** @var Node\AttributeGroup[] */
+ protected $attributeGroups = [];
+
+ /**
+ * Creates a property builder.
+ *
+ * @param string $name Name of the property
+ */
+ public function __construct(string $name) {
+ $this->name = $name;
+ }
+
+ /**
+ * Makes the property public.
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function makePublic() {
+ $this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_PUBLIC);
+
+ return $this;
+ }
+
+ /**
+ * Makes the property protected.
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function makeProtected() {
+ $this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_PROTECTED);
+
+ return $this;
+ }
+
+ /**
+ * Makes the property private.
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function makePrivate() {
+ $this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_PRIVATE);
+
+ return $this;
+ }
+
+ /**
+ * Makes the property static.
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function makeStatic() {
+ $this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_STATIC);
+
+ return $this;
+ }
+
+ /**
+ * Makes the property readonly.
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function makeReadonly() {
+ $this->flags = BuilderHelpers::addModifier($this->flags, Stmt\Class_::MODIFIER_READONLY);
+
+ return $this;
+ }
+
+ /**
+ * Sets default value for the property.
+ *
+ * @param mixed $value Default value to use
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function setDefault($value) {
+ $this->default = BuilderHelpers::normalizeValue($value);
+
+ return $this;
+ }
+
+ /**
+ * Sets doc comment for the property.
+ *
+ * @param PhpParser\Comment\Doc|string $docComment Doc comment to set
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function setDocComment($docComment) {
+ $this->attributes = [
+ 'comments' => [BuilderHelpers::normalizeDocComment($docComment)]
+ ];
+
+ return $this;
+ }
+
+ /**
+ * Sets the property type for PHP 7.4+.
+ *
+ * @param string|Name|Identifier|ComplexType $type
+ *
+ * @return $this
+ */
+ public function setType($type) {
+ $this->type = BuilderHelpers::normalizeType($type);
+
+ return $this;
+ }
+
+ /**
+ * Adds an attribute group.
+ *
+ * @param Node\Attribute|Node\AttributeGroup $attribute
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function addAttribute($attribute) {
+ $this->attributeGroups[] = BuilderHelpers::normalizeAttribute($attribute);
+
+ return $this;
+ }
+
+ /**
+ * Returns the built class node.
+ *
+ * @return Stmt\Property The built property node
+ */
+ public function getNode() : PhpParser\Node {
+ return new Stmt\Property(
+ $this->flags !== 0 ? $this->flags : Stmt\Class_::MODIFIER_PUBLIC,
+ [
+ new Stmt\PropertyProperty($this->name, $this->default)
+ ],
+ $this->attributes,
+ $this->type,
+ $this->attributeGroups
+ );
+ }
+}
diff --git a/vendor/nikic/php-parser/lib/PhpParser/Builder/TraitUse.php b/vendor/nikic/php-parser/lib/PhpParser/Builder/TraitUse.php
new file mode 100644
index 000000000..311e8cd7b
--- /dev/null
+++ b/vendor/nikic/php-parser/lib/PhpParser/Builder/TraitUse.php
@@ -0,0 +1,64 @@
+<?php declare(strict_types=1);
+
+namespace PhpParser\Builder;
+
+use PhpParser\Builder;
+use PhpParser\BuilderHelpers;
+use PhpParser\Node;
+use PhpParser\Node\Stmt;
+
+class TraitUse implements Builder
+{
+ protected $traits = [];
+ protected $adaptations = [];
+
+ /**
+ * Creates a trait use builder.
+ *
+ * @param Node\Name|string ...$traits Names of used traits
+ */
+ public function __construct(...$traits) {
+ foreach ($traits as $trait) {
+ $this->and($trait);
+ }
+ }
+
+ /**
+ * Adds used trait.
+ *
+ * @param Node\Name|string $trait Trait name
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function and($trait) {
+ $this->traits[] = BuilderHelpers::normalizeName($trait);
+ return $this;
+ }
+
+ /**
+ * Adds trait adaptation.
+ *
+ * @param Stmt\TraitUseAdaptation|Builder\TraitUseAdaptation $adaptation Trait adaptation
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function with($adaptation) {
+ $adaptation = BuilderHelpers::normalizeNode($adaptation);
+
+ if (!$adaptation instanceof Stmt\TraitUseAdaptation) {
+ throw new \LogicException('Adaptation must have type TraitUseAdaptation');
+ }
+
+ $this->adaptations[] = $adaptation;
+ return $this;
+ }
+
+ /**
+ * Returns the built node.
+ *
+ * @return Node The built node
+ */
+ public function getNode() : Node {
+ return new Stmt\TraitUse($this->traits, $this->adaptations);
+ }
+}
diff --git a/vendor/nikic/php-parser/lib/PhpParser/Builder/TraitUseAdaptation.php b/vendor/nikic/php-parser/lib/PhpParser/Builder/TraitUseAdaptation.php
new file mode 100644
index 000000000..eb6c0b622
--- /dev/null
+++ b/vendor/nikic/php-parser/lib/PhpParser/Builder/TraitUseAdaptation.php
@@ -0,0 +1,148 @@
+<?php declare(strict_types=1);
+
+namespace PhpParser\Builder;
+
+use PhpParser\Builder;
+use PhpParser\BuilderHelpers;
+use PhpParser\Node;
+use PhpParser\Node\Stmt;
+
+class TraitUseAdaptation implements Builder
+{
+ const TYPE_UNDEFINED = 0;
+ const TYPE_ALIAS = 1;
+ const TYPE_PRECEDENCE = 2;
+
+ /** @var int Type of building adaptation */
+ protected $type;
+
+ protected $trait;
+ protected $method;
+
+ protected $modifier = null;
+ protected $alias = null;
+
+ protected $insteadof = [];
+
+ /**
+ * Creates a trait use adaptation builder.
+ *
+ * @param Node\Name|string|null $trait Name of adaptated trait
+ * @param Node\Identifier|string $method Name of adaptated method
+ */
+ public function __construct($trait, $method) {
+ $this->type = self::TYPE_UNDEFINED;
+
+ $this->trait = is_null($trait)? null: BuilderHelpers::normalizeName($trait);
+ $this->method = BuilderHelpers::normalizeIdentifier($method);
+ }
+
+ /**
+ * Sets alias of method.
+ *
+ * @param Node\Identifier|string $alias Alias for adaptated method
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function as($alias) {
+ if ($this->type === self::TYPE_UNDEFINED) {
+ $this->type = self::TYPE_ALIAS;
+ }
+
+ if ($this->type !== self::TYPE_ALIAS) {
+ throw new \LogicException('Cannot set alias for not alias adaptation buider');
+ }
+
+ $this->alias = $alias;
+ return $this;
+ }
+
+ /**
+ * Sets adaptated method public.
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function makePublic() {
+ $this->setModifier(Stmt\Class_::MODIFIER_PUBLIC);
+ return $this;
+ }
+
+ /**
+ * Sets adaptated method protected.
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function makeProtected() {
+ $this->setModifier(Stmt\Class_::MODIFIER_PROTECTED);
+ return $this;
+ }
+
+ /**
+ * Sets adaptated method private.
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function makePrivate() {
+ $this->setModifier(Stmt\Class_::MODIFIER_PRIVATE);
+ return $this;
+ }
+
+ /**
+ * Adds overwritten traits.
+ *
+ * @param Node\Name|string ...$traits Traits for overwrite
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function insteadof(...$traits) {
+ if ($this->type === self::TYPE_UNDEFINED) {
+ if (is_null($this->trait)) {
+ throw new \LogicException('Precedence adaptation must have trait');
+ }
+
+ $this->type = self::TYPE_PRECEDENCE;
+ }
+
+ if ($this->type !== self::TYPE_PRECEDENCE) {
+ throw new \LogicException('Cannot add overwritten traits for not precedence adaptation buider');
+ }
+
+ foreach ($traits as $trait) {
+ $this->insteadof[] = BuilderHelpers::normalizeName($trait);
+ }
+
+ return $this;
+ }
+
+ protected function setModifier(int $modifier) {
+ if ($this->type === self::TYPE_UNDEFINED) {
+ $this->type = self::TYPE_ALIAS;
+ }
+
+ if ($this->type !== self::TYPE_ALIAS) {
+ throw new \LogicException('Cannot set access modifier for not alias adaptation buider');
+ }
+
+ if (is_null($this->modifier)) {
+ $this->modifier = $modifier;
+ } else {
+ throw new \LogicException('Multiple access type modifiers are not allowed');
+ }
+ }
+
+ /**
+ * Returns the built node.
+ *
+ * @return Node The built node
+ */
+ public function getNode() : Node {
+ switch ($this->type) {
+ case self::TYPE_ALIAS:
+ return new Stmt\TraitUseAdaptation\Alias($this->trait, $this->method, $this->modifier, $this->alias);
+ case self::TYPE_PRECEDENCE:
+ return new Stmt\TraitUseAdaptation\Precedence($this->trait, $this->method, $this->insteadof);
+ default:
+ throw new \LogicException('Type of adaptation is not defined');
+ }
+ }
+}
diff --git a/vendor/nikic/php-parser/lib/PhpParser/Builder/Trait_.php b/vendor/nikic/php-parser/lib/PhpParser/Builder/Trait_.php
new file mode 100644
index 000000000..97f32f98d
--- /dev/null
+++ b/vendor/nikic/php-parser/lib/PhpParser/Builder/Trait_.php
@@ -0,0 +1,78 @@
+<?php declare(strict_types=1);
+
+namespace PhpParser\Builder;
+
+use PhpParser;
+use PhpParser\BuilderHelpers;
+use PhpParser\Node;
+use PhpParser\Node\Stmt;
+
+class Trait_ extends Declaration
+{
+ protected $name;
+ protected $uses = [];
+ protected $properties = [];
+ protected $methods = [];
+
+ /** @var Node\AttributeGroup[] */
+ protected $attributeGroups = [];
+
+ /**
+ * Creates an interface builder.
+ *
+ * @param string $name Name of the interface
+ */
+ public function __construct(string $name) {
+ $this->name = $name;
+ }
+
+ /**
+ * Adds a statement.
+ *
+ * @param Stmt|PhpParser\Builder $stmt The statement to add
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function addStmt($stmt) {
+ $stmt = BuilderHelpers::normalizeNode($stmt);
+
+ if ($stmt instanceof Stmt\Property) {
+ $this->properties[] = $stmt;
+ } elseif ($stmt instanceof Stmt\ClassMethod) {
+ $this->methods[] = $stmt;
+ } elseif ($stmt instanceof Stmt\TraitUse) {
+ $this->uses[] = $stmt;
+ } else {
+ throw new \LogicException(sprintf('Unexpected node of type "%s"', $stmt->getType()));
+ }
+
+ return $this;
+ }
+
+ /**
+ * Adds an attribute group.
+ *
+ * @param Node\Attribute|Node\AttributeGroup $attribute
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function addAttribute($attribute) {
+ $this->attributeGroups[] = BuilderHelpers::normalizeAttribute($attribute);
+
+ return $this;
+ }
+
+ /**
+ * Returns the built trait node.
+ *
+ * @return Stmt\Trait_ The built interface node
+ */
+ public function getNode() : PhpParser\Node {
+ return new Stmt\Trait_(
+ $this->name, [
+ 'stmts' => array_merge($this->uses, $this->properties, $this->methods),
+ 'attrGroups' => $this->attributeGroups,
+ ], $this->attributes
+ );
+ }
+}
diff --git a/vendor/nikic/php-parser/lib/PhpParser/Builder/Use_.php b/vendor/nikic/php-parser/lib/PhpParser/Builder/Use_.php
new file mode 100644
index 000000000..4bd3d12df
--- /dev/null
+++ b/vendor/nikic/php-parser/lib/PhpParser/Builder/Use_.php
@@ -0,0 +1,49 @@
+<?php declare(strict_types=1);
+
+namespace PhpParser\Builder;
+
+use PhpParser\Builder;
+use PhpParser\BuilderHelpers;
+use PhpParser\Node;
+use PhpParser\Node\Stmt;
+
+class Use_ implements Builder
+{
+ protected $name;
+ protected $type;
+ protected $alias = null;
+
+ /**
+ * Creates a name use (alias) builder.
+ *
+ * @param Node\Name|string $name Name of the entity (namespace, class, function, constant) to alias
+ * @param int $type One of the Stmt\Use_::TYPE_* constants
+ */
+ public function __construct($name, int $type) {
+ $this->name = BuilderHelpers::normalizeName($name);
+ $this->type = $type;
+ }
+
+ /**
+ * Sets alias for used name.
+ *
+ * @param string $alias Alias to use (last component of full name by default)
+ *
+ * @return $this The builder instance (for fluid interface)
+ */
+ public function as(string $alias) {
+ $this->alias = $alias;
+ return $this;
+ }
+
+ /**
+ * Returns the built node.
+ *
+ * @return Stmt\Use_ The built node
+ */
+ public function getNode() : Node {
+ return new Stmt\Use_([
+ new Stmt\UseUse($this->name, $this->alias)
+ ], $this->type);
+ }
+}