summaryrefslogtreecommitdiff
path: root/vendor/doctrine/annotations/lib
diff options
context:
space:
mode:
authorDevian <devianleong@gmail.com>2021-04-22 17:11:12 +0800
committerDevian <devianleong@gmail.com>2021-04-22 17:11:12 +0800
commitbf68fa166afb95d682007e7671c2b0692227bec5 (patch)
tree26091a1e5a821905b8bdba73fd1ddb95e12f887e /vendor/doctrine/annotations/lib
parent745cf2431a71d0e6c5f08f8605839279b2f7496e (diff)
Initial
Diffstat (limited to 'vendor/doctrine/annotations/lib')
-rw-r--r--vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation.php59
-rw-r--r--vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Attribute.php21
-rw-r--r--vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Attributes.php15
-rw-r--r--vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Enum.php69
-rw-r--r--vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/IgnoreAnnotation.php43
-rw-r--r--vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/NamedArgumentConstructor.php13
-rw-r--r--vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Required.php13
-rw-r--r--vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Target.php101
-rw-r--r--vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationException.php171
-rw-r--r--vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationReader.php389
-rw-r--r--vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationRegistry.php190
-rw-r--r--vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/CachedReader.php264
-rw-r--r--vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocLexer.php129
-rw-r--r--vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php1459
-rw-r--r--vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/FileCacheReader.php315
-rw-r--r--vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/ImplicitlyIgnoredAnnotationNames.php171
-rw-r--r--vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/IndexedReader.php100
-rw-r--r--vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/NamedArgumentConstructorAnnotation.php14
-rw-r--r--vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/PhpParser.php92
-rw-r--r--vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Reader.php80
-rw-r--r--vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/SimpleAnnotationReader.php114
-rw-r--r--vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/TokenParser.php208
22 files changed, 0 insertions, 4030 deletions
diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation.php
deleted file mode 100644
index 750270e..0000000
--- a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation.php
+++ /dev/null
@@ -1,59 +0,0 @@
-<?php
-
-namespace Doctrine\Common\Annotations;
-
-use BadMethodCallException;
-
-use function sprintf;
-
-/**
- * Annotations class.
- */
-class Annotation
-{
- /**
- * Value property. Common among all derived classes.
- *
- * @var mixed
- */
- public $value;
-
- /**
- * @param array<string, mixed> $data Key-value for properties to be defined in this class.
- */
- final public function __construct(array $data)
- {
- foreach ($data as $key => $value) {
- $this->$key = $value;
- }
- }
-
- /**
- * Error handler for unknown property accessor in Annotation class.
- *
- * @param string $name Unknown property name.
- *
- * @throws BadMethodCallException
- */
- public function __get($name)
- {
- throw new BadMethodCallException(
- sprintf("Unknown property '%s' on annotation '%s'.", $name, static::class)
- );
- }
-
- /**
- * Error handler for unknown property mutator in Annotation class.
- *
- * @param string $name Unknown property name.
- * @param mixed $value Property value.
- *
- * @throws BadMethodCallException
- */
- public function __set($name, $value)
- {
- throw new BadMethodCallException(
- sprintf("Unknown property '%s' on annotation '%s'.", $name, static::class)
- );
- }
-}
diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Attribute.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Attribute.php
deleted file mode 100644
index b1f8514..0000000
--- a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Attribute.php
+++ /dev/null
@@ -1,21 +0,0 @@
-<?php
-
-namespace Doctrine\Common\Annotations\Annotation;
-
-/**
- * Annotation that can be used to signal to the parser
- * to check the attribute type during the parsing process.
- *
- * @Annotation
- */
-final class Attribute
-{
- /** @var string */
- public $name;
-
- /** @var string */
- public $type;
-
- /** @var bool */
- public $required = false;
-}
diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Attributes.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Attributes.php
deleted file mode 100644
index 8f758f3..0000000
--- a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Attributes.php
+++ /dev/null
@@ -1,15 +0,0 @@
-<?php
-
-namespace Doctrine\Common\Annotations\Annotation;
-
-/**
- * Annotation that can be used to signal to the parser
- * to check the types of all declared attributes during the parsing process.
- *
- * @Annotation
- */
-final class Attributes
-{
- /** @var array<Attribute> */
- public $value;
-}
diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Enum.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Enum.php
deleted file mode 100644
index 35d6410..0000000
--- a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Enum.php
+++ /dev/null
@@ -1,69 +0,0 @@
-<?php
-
-namespace Doctrine\Common\Annotations\Annotation;
-
-use InvalidArgumentException;
-
-use function get_class;
-use function gettype;
-use function in_array;
-use function is_object;
-use function is_scalar;
-use function sprintf;
-
-/**
- * Annotation that can be used to signal to the parser
- * to check the available values during the parsing process.
- *
- * @Annotation
- * @Attributes({
- * @Attribute("value", required = true, type = "array"),
- * @Attribute("literal", required = false, type = "array")
- * })
- */
-final class Enum
-{
- /** @phpstan-var list<scalar> */
- public $value;
-
- /**
- * Literal target declaration.
- *
- * @var mixed[]
- */
- public $literal;
-
- /**
- * @throws InvalidArgumentException
- *
- * @phpstan-param array{literal?: mixed[], value: list<scalar>} $values
- */
- public function __construct(array $values)
- {
- if (! isset($values['literal'])) {
- $values['literal'] = [];
- }
-
- foreach ($values['value'] as $var) {
- if (! is_scalar($var)) {
- throw new InvalidArgumentException(sprintf(
- '@Enum supports only scalar values "%s" given.',
- is_object($var) ? get_class($var) : gettype($var)
- ));
- }
- }
-
- foreach ($values['literal'] as $key => $var) {
- if (! in_array($key, $values['value'])) {
- throw new InvalidArgumentException(sprintf(
- 'Undefined enumerator value "%s" for literal "%s".',
- $key,
- $var
- ));
- }
- }
-
- $this->value = $values['value'];
- $this->literal = $values['literal'];
- }
-}
diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/IgnoreAnnotation.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/IgnoreAnnotation.php
deleted file mode 100644
index ae60f7d..0000000
--- a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/IgnoreAnnotation.php
+++ /dev/null
@@ -1,43 +0,0 @@
-<?php
-
-namespace Doctrine\Common\Annotations\Annotation;
-
-use RuntimeException;
-
-use function is_array;
-use function is_string;
-use function json_encode;
-use function sprintf;
-
-/**
- * Annotation that can be used to signal to the parser to ignore specific
- * annotations during the parsing process.
- *
- * @Annotation
- */
-final class IgnoreAnnotation
-{
- /** @phpstan-var list<string> */
- public $names;
-
- /**
- * @throws RuntimeException
- *
- * @phpstan-param array{value: string|list<string>} $values
- */
- public function __construct(array $values)
- {
- if (is_string($values['value'])) {
- $values['value'] = [$values['value']];
- }
-
- if (! is_array($values['value'])) {
- throw new RuntimeException(sprintf(
- '@IgnoreAnnotation expects either a string name, or an array of strings, but got %s.',
- json_encode($values['value'])
- ));
- }
-
- $this->names = $values['value'];
- }
-}
diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/NamedArgumentConstructor.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/NamedArgumentConstructor.php
deleted file mode 100644
index 1690601..0000000
--- a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/NamedArgumentConstructor.php
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php
-
-namespace Doctrine\Common\Annotations\Annotation;
-
-/**
- * Annotation that indicates that the annotated class should be constructed with a named argument call.
- *
- * @Annotation
- * @Target("CLASS")
- */
-final class NamedArgumentConstructor
-{
-}
diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Required.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Required.php
deleted file mode 100644
index dee5857..0000000
--- a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Required.php
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php
-
-namespace Doctrine\Common\Annotations\Annotation;
-
-/**
- * Annotation that can be used to signal to the parser
- * to check if that attribute is required during the parsing process.
- *
- * @Annotation
- */
-final class Required
-{
-}
diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Target.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Target.php
deleted file mode 100644
index 7fd75e2..0000000
--- a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Annotation/Target.php
+++ /dev/null
@@ -1,101 +0,0 @@
-<?php
-
-namespace Doctrine\Common\Annotations\Annotation;
-
-use InvalidArgumentException;
-
-use function array_keys;
-use function get_class;
-use function gettype;
-use function implode;
-use function is_array;
-use function is_object;
-use function is_string;
-use function sprintf;
-
-/**
- * Annotation that can be used to signal to the parser
- * to check the annotation target during the parsing process.
- *
- * @Annotation
- */
-final class Target
-{
- public const TARGET_CLASS = 1;
- public const TARGET_METHOD = 2;
- public const TARGET_PROPERTY = 4;
- public const TARGET_ANNOTATION = 8;
- public const TARGET_FUNCTION = 16;
- public const TARGET_ALL = 31;
-
- /** @var array<string, int> */
- private static $map = [
- 'ALL' => self::TARGET_ALL,
- 'CLASS' => self::TARGET_CLASS,
- 'METHOD' => self::TARGET_METHOD,
- 'PROPERTY' => self::TARGET_PROPERTY,
- 'FUNCTION' => self::TARGET_FUNCTION,
- 'ANNOTATION' => self::TARGET_ANNOTATION,
- ];
-
- /** @phpstan-var list<string> */
- public $value;
-
- /**
- * Targets as bitmask.
- *
- * @var int
- */
- public $targets;
-
- /**
- * Literal target declaration.
- *
- * @var string
- */
- public $literal;
-
- /**
- * @throws InvalidArgumentException
- *
- * @phpstan-param array{value?: string|list<string>} $values
- */
- public function __construct(array $values)
- {
- if (! isset($values['value'])) {
- $values['value'] = null;
- }
-
- if (is_string($values['value'])) {
- $values['value'] = [$values['value']];
- }
-
- if (! is_array($values['value'])) {
- throw new InvalidArgumentException(
- sprintf(
- '@Target expects either a string value, or an array of strings, "%s" given.',
- is_object($values['value']) ? get_class($values['value']) : gettype($values['value'])
- )
- );
- }
-
- $bitmask = 0;
- foreach ($values['value'] as $literal) {
- if (! isset(self::$map[$literal])) {
- throw new InvalidArgumentException(
- sprintf(
- 'Invalid Target "%s". Available targets: [%s]',
- $literal,
- implode(', ', array_keys(self::$map))
- )
- );
- }
-
- $bitmask |= self::$map[$literal];
- }
-
- $this->targets = $bitmask;
- $this->value = $values['value'];
- $this->literal = implode(', ', $this->value);
- }
-}
diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationException.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationException.php
deleted file mode 100644
index b1ea64e..0000000
--- a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationException.php
+++ /dev/null
@@ -1,171 +0,0 @@
-<?php
-
-namespace Doctrine\Common\Annotations;
-
-use Exception;
-
-use function get_class;
-use function gettype;
-use function implode;
-use function is_object;
-use function sprintf;
-
-/**
- * Description of AnnotationException
- */
-class AnnotationException extends Exception
-{
- /**
- * Creates a new AnnotationException describing a Syntax error.
- *
- * @param string $message Exception message
- *
- * @return AnnotationException
- */
- public static function syntaxError($message)
- {
- return new self('[Syntax Error] ' . $message);
- }
-
- /**
- * Creates a new AnnotationException describing a Semantical error.
- *
- * @param string $message Exception message
- *
- * @return AnnotationException
- */
- public static function semanticalError($message)
- {
- return new self('[Semantical Error] ' . $message);
- }
-
- /**
- * Creates a new AnnotationException describing an error which occurred during
- * the creation of the annotation.
- *
- * @param string $message
- *
- * @return AnnotationException
- */
- public static function creationError($message)
- {
- return new self('[Creation Error] ' . $message);
- }
-
- /**
- * Creates a new AnnotationException describing a type error.
- *
- * @param string $message
- *
- * @return AnnotationException
- */
- public static function typeError($message)
- {
- return new self('[Type Error] ' . $message);
- }
-
- /**
- * Creates a new AnnotationException describing a constant semantical error.
- *
- * @param string $identifier
- * @param string $context
- *
- * @return AnnotationException
- */
- public static function semanticalErrorConstants($identifier, $context = null)
- {
- return self::semanticalError(sprintf(
- "Couldn't find constant %s%s.",
- $identifier,
- $context ? ', ' . $context : ''
- ));
- }
-
- /**
- * Creates a new AnnotationException describing an type error of an attribute.
- *
- * @param string $attributeName
- * @param string $annotationName
- * @param string $context
- * @param string $expected
- * @param mixed $actual
- *
- * @return AnnotationException
- */
- public static function attributeTypeError($attributeName, $annotationName, $context, $expected, $actual)
- {
- return self::typeError(sprintf(
- 'Attribute "%s" of @%s declared on %s expects %s, but got %s.',
- $attributeName,
- $annotationName,
- $context,
- $expected,
- is_object($actual) ? 'an instance of ' . get_class($actual) : gettype($actual)
- ));
- }
-
- /**
- * Creates a new AnnotationException describing an required error of an attribute.
- *
- * @param string $attributeName
- * @param string $annotationName
- * @param string $context
- * @param string $expected
- *
- * @return AnnotationException
- */
- public static function requiredError($attributeName, $annotationName, $context, $expected)
- {
- return self::typeError(sprintf(
- 'Attribute "%s" of @%s declared on %s expects %s. This value should not be null.',
- $attributeName,
- $annotationName,
- $context,
- $expected
- ));
- }
-
- /**
- * Creates a new AnnotationException describing a invalid enummerator.
- *
- * @param string $attributeName
- * @param string $annotationName
- * @param string $context
- * @param mixed $given
- *
- * @return AnnotationException
- *
- * @phpstan-param list<string> $available
- */
- public static function enumeratorError($attributeName, $annotationName, $context, $available, $given)
- {
- return new self(sprintf(
- '[Enum Error] Attribute "%s" of @%s declared on %s accepts only [%s], but got %s.',
- $attributeName,
- $annotationName,
- $context,
- implode(', ', $available),
- is_object($given) ? get_class($given) : $given
- ));
- }
-
- /**
- * @return AnnotationException
- */
- public static function optimizerPlusSaveComments()
- {
- return new self(
- 'You have to enable opcache.save_comments=1 or zend_optimizerplus.save_comments=1.'
- );
- }
-
- /**
- * @return AnnotationException
- */
- public static function optimizerPlusLoadComments()
- {
- return new self(
- 'You have to enable opcache.load_comments=1 or zend_optimizerplus.load_comments=1.'
- );
- }
-}
diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationReader.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationReader.php
deleted file mode 100644
index 1f538ee..0000000
--- a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationReader.php
+++ /dev/null
@@ -1,389 +0,0 @@
-<?php
-
-namespace Doctrine\Common\Annotations;
-
-use Doctrine\Common\Annotations\Annotation\IgnoreAnnotation;
-use Doctrine\Common\Annotations\Annotation\Target;
-use ReflectionClass;
-use ReflectionFunction;
-use ReflectionMethod;
-use ReflectionProperty;
-
-use function array_merge;
-use function class_exists;
-use function extension_loaded;
-use function ini_get;
-
-/**
- * A reader for docblock annotations.
- */
-class AnnotationReader implements Reader
-{
- /**
- * Global map for imports.
- *
- * @var array<string, class-string>
- */
- private static $globalImports = [
- 'ignoreannotation' => Annotation\IgnoreAnnotation::class,
- ];
-
- /**
- * A list with annotations that are not causing exceptions when not resolved to an annotation class.
- *
- * The names are case sensitive.
- *
- * @var array<string, true>
- */
- private static $globalIgnoredNames = ImplicitlyIgnoredAnnotationNames::LIST;
-
- /**
- * A list with annotations that are not causing exceptions when not resolved to an annotation class.
- *
- * The names are case sensitive.
- *
- * @var array<string, true>
- */
- private static $globalIgnoredNamespaces = [];
-
- /**
- * Add a new annotation to the globally ignored annotation names with regard to exception handling.
- *
- * @param string $name
- */
- public static function addGlobalIgnoredName($name)
- {
- self::$globalIgnoredNames[$name] = true;
- }
-
- /**
- * Add a new annotation to the globally ignored annotation namespaces with regard to exception handling.
- *
- * @param string $namespace
- */
- public static function addGlobalIgnoredNamespace($namespace)
- {
- self::$globalIgnoredNamespaces[$namespace] = true;
- }
-
- /**
- * Annotations parser.
- *
- * @var DocParser
- */
- private $parser;
-
- /**
- * Annotations parser used to collect parsing metadata.
- *
- * @var DocParser
- */
- private $preParser;
-
- /**
- * PHP parser used to collect imports.
- *
- * @var PhpParser
- */
- private $phpParser;
-
- /**
- * In-memory cache mechanism to store imported annotations per class.
- *
- * @psalm-var array<'class'|'function', array<string, array<string, class-string>>>
- */
- private $imports = [];
-
- /**
- * In-memory cache mechanism to store ignored annotations per class.
- *
- * @psalm-var array<'class'|'function', array<string, array<string, true>>>
- */
- private $ignoredAnnotationNames = [];
-
- /**
- * Initializes a new AnnotationReader.
- *
- * @throws AnnotationException
- */
- public function __construct(?DocParser $parser = null)
- {
- if (
- extension_loaded('Zend Optimizer+') && (ini_get('zend_optimizerplus.save_comments') === '0' ||
- ini_get('opcache.save_comments') === '0')
- ) {
- throw AnnotationException::optimizerPlusSaveComments();
- }
-
- if (extension_loaded('Zend OPcache') && ini_get('opcache.save_comments') === 0) {
- throw AnnotationException::optimizerPlusSaveComments();
- }
-
- // Make sure that the IgnoreAnnotation annotation is loaded
- class_exists(IgnoreAnnotation::class);
-
- $this->parser = $parser ?: new DocParser();
-
- $this->preParser = new DocParser();
-
- $this->preParser->setImports(self::$globalImports);
- $this->preParser->setIgnoreNotImportedAnnotations(true);
- $this->preParser->setIgnoredAnnotationNames(self::$globalIgnoredNames);
-
- $this->phpParser = new PhpParser();
- }
-
- /**
- * {@inheritDoc}
- */
- public function getClassAnnotations(ReflectionClass $class)
- {
- $this->parser->setTarget(Target::TARGET_CLASS);
- $this->parser->setImports($this->getImports($class));
- $this->parser->setIgnoredAnnotationNames($this->getIgnoredAnnotationNames($class));
- $this->parser->setIgnoredAnnotationNamespaces(self::$globalIgnoredNamespaces);
-
- return $this->parser->parse($class->getDocComment(), 'class ' . $class->getName());
- }
-
- /**
- * {@inheritDoc}
- */
- public function getClassAnnotation(ReflectionClass $class, $annotationName)
- {
- $annotations = $this->getClassAnnotations($class);
-
- foreach ($annotations as $annotation) {
- if ($annotation instanceof $annotationName) {
- return $annotation;
- }
- }
-
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- public function getPropertyAnnotations(ReflectionProperty $property)
- {
- $class = $property->getDeclaringClass();
- $context = 'property ' . $class->getName() . '::$' . $property->getName();
-
- $this->parser->setTarget(Target::TARGET_PROPERTY);
- $this->parser->setImports($this->getPropertyImports($property));
- $this->parser->setIgnoredAnnotationNames($this->getIgnoredAnnotationNames($class));
- $this->parser->setIgnoredAnnotationNamespaces(self::$globalIgnoredNamespaces);
-
- return $this->parser->parse($property->getDocComment(), $context);
- }
-
- /**
- * {@inheritDoc}
- */
- public function getPropertyAnnotation(ReflectionProperty $property, $annotationName)
- {
- $annotations = $this->getPropertyAnnotations($property);
-
- foreach ($annotations as $annotation) {
- if ($annotation instanceof $annotationName) {
- return $annotation;
- }
- }
-
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- public function getMethodAnnotations(ReflectionMethod $method)
- {
- $class = $method->getDeclaringClass();
- $context = 'method ' . $class->getName() . '::' . $method->getName() . '()';
-
- $this->parser->setTarget(Target::TARGET_METHOD);
- $this->parser->setImports($this->getMethodImports($method));
- $this->parser->setIgnoredAnnotationNames($this->getIgnoredAnnotationNames($class));
- $this->parser->setIgnoredAnnotationNamespaces(self::$globalIgnoredNamespaces);
-
- return $this->parser->parse($method->getDocComment(), $context);
- }
-
- /**
- * {@inheritDoc}
- */
- public function getMethodAnnotation(ReflectionMethod $method, $annotationName)
- {
- $annotations = $this->getMethodAnnotations($method);
-
- foreach ($annotations as $annotation) {
- if ($annotation instanceof $annotationName) {
- return $annotation;
- }
- }
-
- return null;
- }
-
- /**
- * Gets the annotations applied to a function.
- *
- * @phpstan-return list<object> An array of Annotations.
- */
- public function getFunctionAnnotations(ReflectionFunction $function): array
- {
- $context = 'function ' . $function->getName();
-
- $this->parser->setTarget(Target::TARGET_FUNCTION);
- $this->parser->setImports($this->getImports($function));
- $this->parser->setIgnoredAnnotationNames($this->getIgnoredAnnotationNames($function));
- $this->parser->setIgnoredAnnotationNamespaces(self::$globalIgnoredNamespaces);
-
- return $this->parser->parse($function->getDocComment(), $context);
- }
-
- /**
- * Gets a function annotation.
- *
- * @return object|null The Annotation or NULL, if the requested annotation does not exist.
- */
- public function getFunctionAnnotation(ReflectionFunction $function, string $annotationName)
- {
- $annotations = $this->getFunctionAnnotations($function);
-
- foreach ($annotations as $annotation) {
- if ($annotation instanceof $annotationName) {
- return $annotation;
- }
- }
-
- return null;
- }
-
- /**
- * Returns the ignored annotations for the given class or function.
- *
- * @param ReflectionClass|ReflectionFunction $reflection
- *
- * @return array<string, true>
- */
- private function getIgnoredAnnotationNames($reflection): array
- {
- $type = $reflection instanceof ReflectionClass ? 'class' : 'function';
- $name = $reflection->getName();
-
- if (isset($this->ignoredAnnotationNames[$type][$name])) {
- return $this->ignoredAnnotationNames[$type][$name];
- }
-
- $this->collectParsingMetadata($reflection);
-
- return $this->ignoredAnnotationNames[$type][$name];
- }
-
- /**
- * Retrieves imports for a class or a function.
- *
- * @param ReflectionClass|ReflectionFunction $reflection
- *
- * @return array<string, class-string>
- */
- private function getImports($reflection): array
- {
- $type = $reflection instanceof ReflectionClass ? 'class' : 'function';
- $name = $reflection->getName();
-
- if (isset($this->imports[$type][$name])) {
- return $this->imports[$type][$name];
- }
-
- $this->collectParsingMetadata($reflection);
-
- return $this->imports[$type][$name];
- }
-
- /**
- * Retrieves imports for methods.
- *
- * @return array<string, class-string>
- */
- private function getMethodImports(ReflectionMethod $method)
- {
- $class = $method->getDeclaringClass();
- $classImports = $this->getImports($class);
-
- $traitImports = [];
-
- foreach ($class->getTraits() as $trait) {
- if (
- ! $trait->hasMethod($method->getName())
- || $trait->getFileName() !== $method->getFileName()
- ) {
- continue;
- }
-
- $traitImports = array_merge($traitImports, $this->phpParser->parseUseStatements($trait));
- }
-
- return array_merge($classImports, $traitImports);
- }
-
- /**
- * Retrieves imports for properties.
- *
- * @return array<string, class-string>
- */
- private function getPropertyImports(ReflectionProperty $property)
- {
- $class = $property->getDeclaringClass();
- $classImports = $this->getImports($class);
-
- $traitImports = [];
-
- foreach ($class->getTraits() as $trait) {
- if (! $trait->hasProperty($property->getName())) {
- continue;
- }
-
- $traitImports = array_merge($traitImports, $this->phpParser->parseUseStatements($trait));
- }
-
- return array_merge($classImports, $traitImports);
- }
-
- /**
- * Collects parsing metadata for a given class or function.
- *
- * @param ReflectionClass|ReflectionFunction $reflection
- */
- private function collectParsingMetadata($reflection): void
- {
- $type = $reflection instanceof ReflectionClass ? 'class' : 'function';
- $name = $reflection->getName();
-
- $ignoredAnnotationNames = self::$globalIgnoredNames;
- $annotations = $this->preParser->parse($reflection->getDocComment(), $type . ' ' . $name);
-
- foreach ($annotations as $annotation) {
- if (! ($annotation instanceof IgnoreAnnotation)) {
- continue;
- }
-
- foreach ($annotation->names as $annot) {
- $ignoredAnnotationNames[$annot] = true;
- }
- }
-
- $this->imports[$type][$name] = array_merge(
- self::$globalImports,
- $this->phpParser->parseUseStatements($reflection),
- [
- '__NAMESPACE__' => $reflection->getNamespaceName(),
- 'self' => $name,
- ]
- );
-
- $this->ignoredAnnotationNames[$type][$name] = $ignoredAnnotationNames;
- }
-}
diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationRegistry.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationRegistry.php
deleted file mode 100644
index 259d497..0000000
--- a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationRegistry.php
+++ /dev/null
@@ -1,190 +0,0 @@
-<?php
-
-namespace Doctrine\Common\Annotations;
-
-use function array_key_exists;
-use function array_merge;
-use function class_exists;
-use function in_array;
-use function is_file;
-use function str_replace;
-use function stream_resolve_include_path;
-use function strpos;
-
-use const DIRECTORY_SEPARATOR;
-
-final class AnnotationRegistry
-{
- /**
- * A map of namespaces to use for autoloading purposes based on a PSR-0 convention.
- *
- * Contains the namespace as key and an array of directories as value. If the value is NULL
- * the include path is used for checking for the corresponding file.
- *
- * This autoloading mechanism does not utilize the PHP autoloading but implements autoloading on its own.
- *
- * @var string[][]|string[]|null[]
- */
- private static $autoloadNamespaces = [];
-
- /**
- * A map of autoloader callables.
- *
- * @var callable[]
- */
- private static $loaders = [];
-
- /**
- * An array of classes which cannot be found
- *
- * @var null[] indexed by class name
- */
- private static $failedToAutoload = [];
-
- /**
- * Whenever registerFile() was used. Disables use of standard autoloader.
- *
- * @var bool
- */
- private static $registerFileUsed = false;
-
- public static function reset(): void
- {
- self::$autoloadNamespaces = [];
- self::$loaders = [];
- self::$failedToAutoload = [];
- self::$registerFileUsed = false;
- }
-
- /**
- * Registers file.
- *
- * @deprecated This method is deprecated and will be removed in
- * doctrine/annotations 2.0. Annotations will be autoloaded in 2.0.
- */
- public static function registerFile(string $file): void
- {
- self::$registerFileUsed = true;
-
- require_once $file;
- }
-
- /**
- * Adds a namespace with one or many directories to look for files or null for the include path.
- *
- * Loading of this namespaces will be done with a PSR-0 namespace loading algorithm.
- *
- * @deprecated This method is deprecated and will be removed in
- * doctrine/annotations 2.0. Annotations will be autoloaded in 2.0.
- *
- * @phpstan-param string|list<string>|null $dirs
- */
- public static function registerAutoloadNamespace(string $namespace, $dirs = null): void
- {
- self::$autoloadNamespaces[$namespace] = $dirs;
- }
-
- /**
- * Registers multiple namespaces.
- *
- * Loading of this namespaces will be done with a PSR-0 namespace loading algorithm.
- *
- * @deprecated This method is deprecated and will be removed in
- * doctrine/annotations 2.0. Annotations will be autoloaded in 2.0.
- *
- * @param string[][]|string[]|null[] $namespaces indexed by namespace name
- */
- public static function registerAutoloadNamespaces(array $namespaces): void
- {
- self::$autoloadNamespaces = array_merge(self::$autoloadNamespaces, $namespaces);
- }
-
- /**
- * Registers an autoloading callable for annotations, much like spl_autoload_register().
- *
- * NOTE: These class loaders HAVE to be silent when a class was not found!
- * IMPORTANT: Loaders have to return true if they loaded a class that could contain the searched annotation class.
- *
- * @deprecated This method is deprecated and will be removed in
- * doctrine/annotations 2.0. Annotations will be autoloaded in 2.0.
- */
- public static function registerLoader(callable $callable): void
- {
- // Reset our static cache now that we have a new loader to work with
- self::$failedToAutoload = [];
- self::$loaders[] = $callable;
- }
-
- /**
- * Registers an autoloading callable for annotations, if it is not already registered
- *
- * @deprecated This method is deprecated and will be removed in
- * doctrine/annotations 2.0. Annotations will be autoloaded in 2.0.
- */
- public static function registerUniqueLoader(callable $callable): void
- {
- if (in_array($callable, self::$loaders, true)) {
- return;
- }
-
- self::registerLoader($callable);
- }
-
- /**
- * Autoloads an annotation class silently.
- */
- public static function loadAnnotationClass(string $class): bool
- {
- if (class_exists($class, false)) {
- return true;
- }
-
- if (array_key_exists($class, self::$failedToAutoload)) {
- return false;
- }
-
- foreach (self::$autoloadNamespaces as $namespace => $dirs) {
- if (strpos($class, $namespace) !== 0) {
- continue;
- }
-
- $file = str_replace('\\', DIRECTORY_SEPARATOR, $class) . '.php';
-
- if ($dirs === null) {
- $path = stream_resolve_include_path($file);
- if ($path) {
- require $path;
-
- return true;
- }
- } else {
- foreach ((array) $dirs as $dir) {
- if (is_file($dir . DIRECTORY_SEPARATOR . $file)) {
- require $dir . DIRECTORY_SEPARATOR . $file;
-
- return true;
- }
- }
- }
- }
-
- foreach (self::$loaders as $loader) {
- if ($loader($class) === true) {
- return true;
- }
- }
-
- if (
- self::$loaders === [] &&
- self::$autoloadNamespaces === [] &&
- self::$registerFileUsed === false &&
- class_exists($class)
- ) {
- return true;
- }
-
- self::$failedToAutoload[$class] = null;
-
- return false;
- }
-}
diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/CachedReader.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/CachedReader.php
deleted file mode 100644
index 91fbad0..0000000
--- a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/CachedReader.php
+++ /dev/null
@@ -1,264 +0,0 @@
-<?php
-
-namespace Doctrine\Common\Annotations;
-
-use Doctrine\Common\Cache\Cache;
-use ReflectionClass;
-use ReflectionMethod;
-use ReflectionProperty;
-
-use function array_map;
-use function array_merge;
-use function assert;
-use function filemtime;
-use function max;
-use function time;
-
-/**
- * A cache aware annotation reader.
- */
-final class CachedReader implements Reader
-{
- /** @var Reader */
- private $delegate;
-
- /** @var Cache */
- private $cache;
-
- /** @var bool */
- private $debug;
-
- /** @var array<string, array<object>> */
- private $loadedAnnotations = [];
-
- /** @var int[] */
- private $loadedFilemtimes = [];
-
- /**
- * @param bool $debug
- */
- public function __construct(Reader $reader, Cache $cache, $debug = false)
- {
- $this->delegate = $reader;
- $this->cache = $cache;
- $this->debug = (bool) $debug;
- }
-
- /**
- * {@inheritDoc}
- */
- public function getClassAnnotations(ReflectionClass $class)
- {
- $cacheKey = $class->getName();
-
- if (isset($this->loadedAnnotations[$cacheKey])) {
- return $this->loadedAnnotations[$cacheKey];
- }
-
- $annots = $this->fetchFromCache($cacheKey, $class);
- if ($annots === false) {
- $annots = $this->delegate->getClassAnnotations($class);
- $this->saveToCache($cacheKey, $annots);
- }
-
- return $this->loadedAnnotations[$cacheKey] = $annots;
- }
-
- /**
- * {@inheritDoc}
- */
- public function getClassAnnotation(ReflectionClass $class, $annotationName)
- {
- foreach ($this->getClassAnnotations($class) as $annot) {
- if ($annot instanceof $annotationName) {
- return $annot;
- }
- }
-
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- public function getPropertyAnnotations(ReflectionProperty $property)
- {
- $class = $property->getDeclaringClass();
- $cacheKey = $class->getName() . '$' . $property->getName();
-
- if (isset($this->loadedAnnotations[$cacheKey])) {
- return $this->loadedAnnotations[$cacheKey];
- }
-
- $annots = $this->fetchFromCache($cacheKey, $class);
- if ($annots === false) {
- $annots = $this->delegate->getPropertyAnnotations($property);
- $this->saveToCache($cacheKey, $annots);
- }
-
- return $this->loadedAnnotations[$cacheKey] = $annots;
- }
-
- /**
- * {@inheritDoc}
- */
- public function getPropertyAnnotation(ReflectionProperty $property, $annotationName)
- {
- foreach ($this->getPropertyAnnotations($property) as $annot) {
- if ($annot instanceof $annotationName) {
- return $annot;
- }
- }
-
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- public function getMethodAnnotations(ReflectionMethod $method)
- {
- $class = $method->getDeclaringClass();
- $cacheKey = $class->getName() . '#' . $method->getName();
-
- if (isset($this->loadedAnnotations[$cacheKey])) {
- return $this->loadedAnnotations[$cacheKey];
- }
-
- $annots = $this->fetchFromCache($cacheKey, $class);
- if ($annots === false) {
- $annots = $this->delegate->getMethodAnnotations($method);
- $this->saveToCache($cacheKey, $annots);
- }
-
- return $this->loadedAnnotations[$cacheKey] = $annots;
- }
-
- /**
- * {@inheritDoc}
- */
- public function getMethodAnnotation(ReflectionMethod $method, $annotationName)
- {
- foreach ($this->getMethodAnnotations($method) as $annot) {
- if ($annot instanceof $annotationName) {
- return $annot;
- }
- }
-
- return null;
- }
-
- /**
- * Clears loaded annotations.
- *
- * @return void
- */
- public function clearLoadedAnnotations()
- {
- $this->loadedAnnotations = [];
- $this->loadedFilemtimes = [];
- }
-
- /**
- * Fetches a value from the cache.
- *
- * @param string $cacheKey The cache key.
- *
- * @return mixed The cached value or false when the value is not in cache.
- */
- private function fetchFromCache($cacheKey, ReflectionClass $class)
- {
- $data = $this->cache->fetch($cacheKey);
- if ($data !== false) {
- if (! $this->debug || $this->isCacheFresh($cacheKey, $class)) {
- return $data;
- }
- }
-
- return false;
- }
-
- /**
- * Saves a value to the cache.
- *
- * @param string $cacheKey The cache key.
- * @param mixed $value The value.
- *
- * @return void
- */
- private function saveToCache($cacheKey, $value)
- {
- $this->cache->save($cacheKey, $value);
- if (! $this->debug) {
- return;
- }
-
- $this->cache->save('[C]' . $cacheKey, time());
- }
-
- /**
- * Checks if the cache is fresh.
- *
- * @param string $cacheKey
- *
- * @return bool
- */
- private function isCacheFresh($cacheKey, ReflectionClass $class)
- {
- $lastModification = $this->getLastModification($class);
- if ($lastModification === 0) {
- return true;
- }
-
- return $this->cache->fetch('[C]' . $cacheKey) >= $lastModification;
- }
-
- /**
- * Returns the time the class was last modified, testing traits and parents
- */
- private function getLastModification(ReflectionClass $class): int
- {
- $filename = $class->getFileName();
-
- if (isset($this->loadedFilemtimes[$filename])) {
- return $this->loadedFilemtimes[$filename];
- }
-
- $parent = $class->getParentClass();
-
- $lastModification = max(array_merge(
- [$filename ? filemtime($filename) : 0],
- array_map(function (ReflectionClass $reflectionTrait): int {
- return $this->getTraitLastModificationTime($reflectionTrait);
- }, $class->getTraits()),
- array_map(function (ReflectionClass $class): int {
- return $this->getLastModification($class);
- }, $class->getInterfaces()),
- $parent ? [$this->getLastModification($parent)] : []
- ));
-
- assert($lastModification !== false);
-
- return $this->loadedFilemtimes[$filename] = $lastModification;
- }
-
- private function getTraitLastModificationTime(ReflectionClass $reflectionTrait): int
- {
- $fileName = $reflectionTrait->getFileName();
-
- if (isset($this->loadedFilemtimes[$fileName])) {
- return $this->loadedFilemtimes[$fileName];
- }
-
- $lastModificationTime = max(array_merge(
- [$fileName ? filemtime($fileName) : 0],
- array_map(function (ReflectionClass $reflectionTrait): int {
- return $this->getTraitLastModificationTime($reflectionTrait);
- }, $reflectionTrait->getTraits())
- ));
-
- assert($lastModificationTime !== false);
-
- return $this->loadedFilemtimes[$fileName] = $lastModificationTime;
- }
-}
diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocLexer.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocLexer.php
deleted file mode 100644
index f6567c5..0000000
--- a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocLexer.php
+++ /dev/null
@@ -1,129 +0,0 @@
-<?php
-
-namespace Doctrine\Common\Annotations;
-
-use Doctrine\Common\Lexer\AbstractLexer;
-
-use function ctype_alpha;
-use function is_numeric;
-use function str_replace;
-use function stripos;
-use function strlen;
-use function strpos;
-use function strtolower;
-use function substr;
-
-/**
- * Simple lexer for docblock annotations.
- */
-final class DocLexer extends AbstractLexer
-{
- public const T_NONE = 1;
- public const T_INTEGER = 2;
- public const T_STRING = 3;
- public const T_FLOAT = 4;
-
- // All tokens that are also identifiers should be >= 100
- public const T_IDENTIFIER = 100;
- public const T_AT = 101;
- public const T_CLOSE_CURLY_BRACES = 102;
- public const T_CLOSE_PARENTHESIS = 103;
- public const T_COMMA = 104;
- public const T_EQUALS = 105;
- public const T_FALSE = 106;
- public const T_NAMESPACE_SEPARATOR = 107;
- public const T_OPEN_CURLY_BRACES = 108;
- public const T_OPEN_PARENTHESIS = 109;
- public const T_TRUE = 110;
- public const T_NULL = 111;
- public const T_COLON = 112;
- public const T_MINUS = 113;
-
- /** @var array<string, int> */
- protected $noCase = [
- '@' => self::T_AT,
- ',' => self::T_COMMA,
- '(' => self::T_OPEN_PARENTHESIS,
- ')' => self::T_CLOSE_PARENTHESIS,
- '{' => self::T_OPEN_CURLY_BRACES,
- '}' => self::T_CLOSE_CURLY_BRACES,
- '=' => self::T_EQUALS,
- ':' => self::T_COLON,
- '-' => self::T_MINUS,
- '\\' => self::T_NAMESPACE_SEPARATOR,
- ];
-
- /** @var array<string, int> */
- protected $withCase = [
- 'true' => self::T_TRUE,
- 'false' => self::T_FALSE,
- 'null' => self::T_NULL,
- ];
-
- /**
- * Whether the next token starts immediately, or if there were
- * non-captured symbols before that
- */
- public function nextTokenIsAdjacent(): bool
- {
- return $this->token === null
- || ($this->lookahead !== null
- && ($this->lookahead['position'] - $this->token['position']) === strlen($this->token['value']));
- }
-
- /**
- * {@inheritdoc}
- */
- protected function getCatchablePatterns()
- {
- return [
- '[a-z_\\\][a-z0-9_\:\\\]*[a-z_][a-z0-9_]*',
- '(?:[+-]?[0-9]+(?:[\.][0-9]+)*)(?:[eE][+-]?[0-9]+)?',
- '"(?:""|[^"])*+"',
- ];
- }
-
- /**
- * {@inheritdoc}
- */
- protected function getNonCatchablePatterns()
- {
- return ['\s+', '\*+', '(.)'];
- }
-
- /**
- * {@inheritdoc}
- */
- protected function getType(&$value)
- {
- $type = self::T_NONE;
-
- if ($value[0] === '"') {
- $value = str_replace('""', '"', substr($value, 1, strlen($value) - 2));
-
- return self::T_STRING;
- }
-
- if (isset($this->noCase[$value])) {
- return $this->noCase[$value];
- }
-
- if ($value[0] === '_' || $value[0] === '\\' || ctype_alpha($value[0])) {
- return self::T_IDENTIFIER;
- }
-
- $lowerValue = strtolower($value);
-
- if (isset($this->withCase[$lowerValue])) {
- return $this->withCase[$lowerValue];
- }
-
- // Checking numeric value
- if (is_numeric($value)) {
- return strpos($value, '.') !== false || stripos($value, 'e') !== false
- ? self::T_FLOAT : self::T_INTEGER;
- }
-
- return $type;
- }
-}
diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php
deleted file mode 100644
index ae530c5..0000000
--- a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php
+++ /dev/null
@@ -1,1459 +0,0 @@
-<?php
-
-namespace Doctrine\Common\Annotations;
-
-use Doctrine\Common\Annotations\Annotation\Attribute;
-use Doctrine\Common\Annotations\Annotation\Attributes;
-use Doctrine\Common\Annotations\Annotation\Enum;
-use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
-use Doctrine\Common\Annotations\Annotation\Target;
-use ReflectionClass;
-use ReflectionException;
-use ReflectionProperty;
-use RuntimeException;
-use stdClass;
-
-use function array_keys;
-use function array_map;
-use function array_pop;
-use function array_values;
-use function class_exists;
-use function constant;
-use function count;
-use function defined;
-use function explode;
-use function gettype;
-use function implode;
-use function in_array;
-use function interface_exists;
-use function is_array;
-use function is_object;
-use function json_encode;
-use function ltrim;
-use function preg_match;
-use function reset;
-use function rtrim;
-use function sprintf;
-use function stripos;
-use function strlen;
-use function strpos;
-use function strrpos;
-use function strtolower;
-use function substr;
-use function trim;
-
-use const PHP_VERSION_ID;
-
-/**
- * A parser for docblock annotations.
- *
- * It is strongly discouraged to change the default annotation parsing process.
- */
-final class DocParser
-{
- /**
- * An array of all valid tokens for a class name.
- *
- * @phpstan-var list<int>
- */
- private static $classIdentifiers = [
- DocLexer::T_IDENTIFIER,
- DocLexer::T_TRUE,
- DocLexer::T_FALSE,
- DocLexer::T_NULL,
- ];
-
- /**
- * The lexer.
- *
- * @var DocLexer
- */
- private $lexer;
-
- /**
- * Current target context.
- *
- * @var int
- */
- private $target;
-
- /**
- * Doc parser used to collect annotation target.
- *
- * @var DocParser
- */
- private static $metadataParser;
-
- /**
- * Flag to control if the current annotation is nested or not.
- *
- * @var bool
- */
- private $isNestedAnnotation = false;
-
- /**
- * Hashmap containing all use-statements that are to be used when parsing
- * the given doc block.
- *
- * @var array<string, class-string>
- */
- private $imports = [];
-
- /**
- * This hashmap is used internally to cache results of class_exists()
- * look-ups.
- *
- * @var array<class-string, bool>
- */
- private $classExists = [];
-
- /**
- * Whether annotations that have not been imported should be ignored.
- *
- * @var bool
- */
- private $ignoreNotImportedAnnotations = false;
-
- /**
- * An array of default namespaces if operating in simple mode.
- *
- * @var string[]
- */
- private $namespaces = [];
-
- /**
- * A list with annotations that are not causing exceptions when not resolved to an annotation class.
- *
- * The names must be the raw names as used in the class, not the fully qualified
- *
- * @var bool[] indexed by annotation name
- */
- private $ignoredAnnotationNames = [];
-
- /**
- * A list with annotations in namespaced format
- * that are not causing exceptions when not resolved to an annotation class.
- *
- * @var bool[] indexed by namespace name
- */
- private $ignoredAnnotationNamespaces = [];
-
- /** @var string */
- private $context = '';
-
- /**
- * Hash-map for caching annotation metadata.
- *
- * @var array<class-string, mixed[]>
- */
- private static $annotationMetadata = [
- Annotation\Target::class => [
- 'is_annotation' => true,
- 'has_constructor' => true,
- 'has_named_argument_constructor' => false,
- 'properties' => [],
- 'targets_literal' => 'ANNOTATION_CLASS',
- 'targets' => Target::TARGET_CLASS,
- 'default_property' => 'value',
- 'attribute_types' => [
- 'value' => [
- 'required' => false,
- 'type' => 'array',
- 'array_type' => 'string',
- 'value' => 'array<string>',
- ],
- ],
- ],
- Annotation\Attribute::class => [
- 'is_annotation' => true,
- 'has_constructor' => false,
- 'has_named_argument_constructor' => false,
- 'targets_literal' => 'ANNOTATION_ANNOTATION',
- 'targets' => Target::TARGET_ANNOTATION,
- 'default_property' => 'name',
- 'properties' => [
- 'name' => 'name',
- 'type' => 'type',
- 'required' => 'required',
- ],
- 'attribute_types' => [
- 'value' => [
- 'required' => true,
- 'type' => 'string',
- 'value' => 'string',
- ],
- 'type' => [
- 'required' => true,
- 'type' => 'string',
- 'value' => 'string',
- ],
- 'required' => [
- 'required' => false,
- 'type' => 'boolean',
- 'value' => 'boolean',
- ],
- ],
- ],
- Annotation\Attributes::class => [
- 'is_annotation' => true,
- 'has_constructor' => false,
- 'has_named_argument_constructor' => false,
- 'targets_literal' => 'ANNOTATION_CLASS',
- 'targets' => Target::TARGET_CLASS,
- 'default_property' => 'value',
- 'properties' => ['value' => 'value'],
- 'attribute_types' => [
- 'value' => [
- 'type' => 'array',
- 'required' => true,
- 'array_type' => Annotation\Attribute::class,
- 'value' => 'array<' . Annotation\Attribute::class . '>',
- ],
- ],
- ],
- Annotation\Enum::class => [
- 'is_annotation' => true,
- 'has_constructor' => true,
- 'has_named_argument_constructor' => false,
- 'targets_literal' => 'ANNOTATION_PROPERTY',
- 'targets' => Target::TARGET_PROPERTY,
- 'default_property' => 'value',
- 'properties' => ['value' => 'value'],
- 'attribute_types' => [
- 'value' => [
- 'type' => 'array',
- 'required' => true,
- ],
- 'literal' => [
- 'type' => 'array',
- 'required' => false,
- ],
- ],
- ],
- Annotation\NamedArgumentConstructor::class => [
- 'is_annotation' => true,
- 'has_constructor' => false,
- 'has_named_argument_constructor' => false,
- 'targets_literal' => 'ANNOTATION_CLASS',
- 'targets' => Target::TARGET_CLASS,
- 'default_property' => null,
- 'properties' => [],
- 'attribute_types' => [],
- ],
- ];
-
- /**
- * Hash-map for handle types declaration.
- *
- * @var array<string, string>
- */
- private static $typeMap = [
- 'float' => 'double',
- 'bool' => 'boolean',
- // allow uppercase Boolean in honor of George Boole
- 'Boolean' => 'boolean',
- 'int' => 'integer',
- ];
-
- /**
- * Constructs a new DocParser.
- */
- public function __construct()
- {
- $this->lexer = new DocLexer();
- }
-
- /**
- * Sets the annotation names that are ignored during the parsing process.
- *
- * The names are supposed to be the raw names as used in the class, not the
- * fully qualified class names.
- *
- * @param bool[] $names indexed by annotation name
- *
- * @return void
- */
- public function setIgnoredAnnotationNames(array $names)
- {
- $this->ignoredAnnotationNames = $names;
- }
-
- /**
- * Sets the annotation namespaces that are ignored during the parsing process.
- *
- * @param bool[] $ignoredAnnotationNamespaces indexed by annotation namespace name
- *
- * @return void
- */
- public function setIgnoredAnnotationNamespaces($ignoredAnnotationNamespaces)
- {
- $this->ignoredAnnotationNamespaces = $ignoredAnnotationNamespaces;
- }
-
- /**
- * Sets ignore on not-imported annotations.
- *
- * @param bool $bool
- *
- * @return void
- */
- public function setIgnoreNotImportedAnnotations($bool)
- {
- $this->ignoreNotImportedAnnotations = (bool) $bool;
- }
-
- /**
- * Sets the default namespaces.
- *
- * @param string $namespace
- *
- * @return void
- *
- * @throws RuntimeException
- */
- public function addNamespace($namespace)
- {
- if ($this->imports) {
- throw new RuntimeException('You must either use addNamespace(), or setImports(), but not both.');
- }
-
- $this->namespaces[] = $namespace;
- }
-
- /**
- * Sets the imports.
- *
- * @param array<string, class-string> $imports
- *
- * @return void
- *
- * @throws RuntimeException
- */
- public function setImports(array $imports)
- {
- if ($this->namespaces) {
- throw new RuntimeException('You must either use addNamespace(), or setImports(), but not both.');
- }
-
- $this->imports = $imports;
- }
-
- /**
- * Sets current target context as bitmask.
- *
- * @param int $target
- *
- * @return void
- */
- public function setTarget($target)
- {
- $this->target = $target;
- }
-
- /**
- * Parses the given docblock string for annotations.
- *
- * @param string $input The docblock string to parse.
- * @param string $context The parsing context.
- *
- * @throws AnnotationException
- * @throws ReflectionException
- *
- * @phpstan-return list<object> Array of annotations. If no annotations are found, an empty array is returned.
- */
- public function parse($input, $context = '')
- {
- $pos = $this->findInitialTokenPosition($input);
- if ($pos === null) {
- return [];
- }
-
- $this->context = $context;
-
- $this->lexer->setInput(trim(substr($input, $pos), '* /'));
- $this->lexer->moveNext();
-
- return $this->Annotations();
- }
-
- /**
- * Finds the first valid annotation
- *
- * @param string $input The docblock string to parse
- */
- private function findInitialTokenPosition($input): ?int
- {
- $pos = 0;
-
- // search for first valid annotation
- while (($pos = strpos($input, '@', $pos)) !== false) {
- $preceding = substr($input, $pos - 1, 1);
-
- // if the @ is preceded by a space, a tab or * it is valid
- if ($pos === 0 || $preceding === ' ' || $preceding === '*' || $preceding === "\t") {
- return $pos;
- }
-
- $pos++;
- }
-
- return null;
- }
-
- /**
- * Attempts to match the given token with the current lookahead token.
- * If they match, updates the lookahead token; otherwise raises a syntax error.
- *
- * @param int $token Type of token.
- *
- * @return bool True if tokens match; false otherwise.
- *
- * @throws AnnotationException
- */
- private function match(int $token): bool
- {
- if (! $this->lexer->isNextToken($token)) {
- throw $this->syntaxError($this->lexer->getLiteral($token));
- }
-
- return $this->lexer->moveNext();
- }
-
- /**
- * Attempts to match the current lookahead token with any of the given tokens.
- *
- * If any of them matches, this method updates the lookahead token; otherwise
- * a syntax error is raised.
- *
- * @throws AnnotationException
- *
- * @phpstan-param list<mixed[]> $tokens
- */
- private function matchAny(array $tokens): bool
- {
- if (! $this->lexer->isNextTokenAny($tokens)) {
- throw $this->syntaxError(implode(' or ', array_map([$this->lexer, 'getLiteral'], $tokens)));
- }
-
- return $this->lexer->moveNext();
- }
-
- /**
- * Generates a new syntax error.
- *
- * @param string $expected Expected string.
- * @param mixed[]|null $token Optional token.
- */
- private function syntaxError(string $expected, ?array $token = null): AnnotationException
- {
- if ($token === null) {
- $token = $this->lexer->lookahead;
- }
-
- $message = sprintf('Expected %s, got ', $expected);
- $message .= $this->lexer->lookahead === null
- ? 'end of string'
- : sprintf("'%s' at position %s", $token['value'], $token['position']);
-
- if (strlen($this->context)) {
- $message .= ' in ' . $this->context;
- }
-
- $message .= '.';
-
- return AnnotationException::syntaxError($message);
- }
-
- /**
- * Attempts to check if a class exists or not. This never goes through the PHP autoloading mechanism
- * but uses the {@link AnnotationRegistry} to load classes.
- *
- * @param class-string $fqcn
- */
- private function classExists(string $fqcn): bool
- {
- if (isset($this->classExists[$fqcn])) {
- return $this->classExists[$fqcn];
- }
-
- // first check if the class already exists, maybe loaded through another AnnotationReader
- if (class_exists($fqcn, false)) {
- return $this->classExists[$fqcn] = true;
- }
-
- // final check, does this class exist?
- return $this->classExists[$fqcn] = AnnotationRegistry::loadAnnotationClass($fqcn);
- }
-
- /**
- * Collects parsing metadata for a given annotation class
- *
- * @param class-string $name The annotation name
- *
- * @throws AnnotationException
- * @throws ReflectionException
- */
- private function collectAnnotationMetadata(string $name): void
- {
- if (self::$metadataParser === null) {
- self::$metadataParser = new self();
-
- self::$metadataParser->setIgnoreNotImportedAnnotations(true);
- self::$metadataParser->setIgnoredAnnotationNames($this->ignoredAnnotationNames);
- self::$metadataParser->setImports([
- 'enum' => Enum::class,
- 'target' => Target::class,
- 'attribute' => Attribute::class,
- 'attributes' => Attributes::class,
- 'namedargumentconstructor' => NamedArgumentConstructor::class,
- ]);
-
- // Make sure that annotations from metadata are loaded
- class_exists(Enum::class);
- class_exists(Target::class);
- class_exists(Attribute::class);
- class_exists(Attributes::class);
- class_exists(NamedArgumentConstructor::class);
- }
-
- $class = new ReflectionClass($name);
- $docComment = $class->getDocComment();
-
- // Sets default values for annotation metadata
- $constructor = $class->getConstructor();
- $metadata = [
- 'default_property' => null,
- 'has_constructor' => $constructor !== null && $constructor->getNumberOfParameters() > 0,
- 'constructor_args' => [],
- 'properties' => [],
- 'property_types' => [],
- 'attribute_types' => [],
- 'targets_literal' => null,
- 'targets' => Target::TARGET_ALL,
- 'is_annotation' => strpos($docComment, '@Annotation') !== false,
- ];
-
- $metadata['has_named_argument_constructor'] = $metadata['has_constructor']
- && $class->implementsInterface(NamedArgumentConstructorAnnotation::class);
-
- // verify that the class is really meant to be an annotation
- if ($metadata['is_annotation']) {
- self::$metadataParser->setTarget(Target::TARGET_CLASS);
-
- foreach (self::$metadataParser->parse($docComment, 'class @' . $name) as $annotation) {
- if ($annotation instanceof Target) {
- $metadata['targets'] = $annotation->targets;
- $metadata['targets_literal'] = $annotation->literal;
-
- continue;
- }
-
- if ($annotation instanceof NamedArgumentConstructor) {
- $metadata['has_named_argument_constructor'] = $metadata['has_constructor'];
- if ($metadata['has_named_argument_constructor']) {
- // choose the first argument as the default property
- $metadata['default_property'] = $constructor->getParameters()[0]->getName();
- }
- }
-
- if (! ($annotation instanceof Attributes)) {
- continue;
- }
-
- foreach ($annotation->value as $attribute) {
- $this->collectAttributeTypeMetadata($metadata, $attribute);
- }
- }
-
- // if not has a constructor will inject values into public properties
- if ($metadata['has_constructor'] === false) {
- // collect all public properties
- foreach ($class->getProperties(ReflectionProperty::IS_PUBLIC) as $property) {
- $metadata['properties'][$property->name] = $property->name;
-
- $propertyComment = $property->getDocComment();
- if ($propertyComment === false) {
- continue;
- }
-
- $attribute = new Attribute();
-
- $attribute->required = (strpos($propertyComment, '@Required') !== false);
- $attribute->name = $property->name;
- $attribute->type = (strpos($propertyComment, '@var') !== false &&
- preg_match('/@var\s+([^\s]+)/', $propertyComment, $matches))
- ? $matches[1]
- : 'mixed';
-
- $this->collectAttributeTypeMetadata($metadata, $attribute);
-
- // checks if the property has @Enum
- if (strpos($propertyComment, '@Enum') === false) {
- continue;
- }
-
- $context = 'property ' . $class->name . '::$' . $property->name;
-
- self::$metadataParser->setTarget(Target::TARGET_PROPERTY);
-
- foreach (self::$metadataParser->parse($propertyComment, $context) as $annotation) {
- if (! $annotation instanceof Enum) {
- continue;
- }
-
- $metadata['enum'][$property->name]['value'] = $annotation->value;
- $metadata['enum'][$property->name]['literal'] = (! empty($annotation->literal))
- ? $annotation->literal
- : $annotation->value;
- }
- }
-
- // choose the first property as default property
- $metadata['default_property'] = reset($metadata['properties']);
- } elseif ($metadata['has_named_argument_constructor']) {
- foreach ($constructor->getParameters() as $parameter) {
- $metadata['constructor_args'][$parameter->getName()] = [
- 'position' => $parameter->getPosition(),
- 'default' => $parameter->isOptional() ? $parameter->getDefaultValue() : null,
- ];
- }
- }
- }
-
- self::$annotationMetadata[$name] = $metadata;
- }
-
- /**
- * Collects parsing metadata for a given attribute.
- *
- * @param mixed[] $metadata
- */
- private function collectAttributeTypeMetadata(array &$metadata, Attribute $attribute): void
- {
- // handle internal type declaration
- $type = self::$typeMap[$attribute->type] ?? $attribute->type;
-
- // handle the case if the property type is mixed
- if ($type === 'mixed') {
- return;
- }
-
- // Evaluate type
- $pos = strpos($type, '<');
- if ($pos !== false) {
- // Checks if the property has array<type>
- $arrayType = substr($type, $pos + 1, -1);
- $type = 'array';
-
- if (isset(self::$typeMap[$arrayType])) {
- $arrayType = self::$typeMap[$arrayType];
- }
-
- $metadata['attribute_types'][$attribute->name]['array_type'] = $arrayType;
- } else {
- // Checks if the property has type[]
- $pos = strrpos($type, '[');
- if ($pos !== false) {
- $arrayType = substr($type, 0, $pos);
- $type = 'array';
-
- if (isset(self::$typeMap[$arrayType])) {
- $arrayType = self::$typeMap[$arrayType];
- }
-
- $metadata['attribute_types'][$attribute->name]['array_type'] = $arrayType;
- }
- }
-
- $metadata['attribute_types'][$attribute->name]['type'] = $type;
- $metadata['attribute_types'][$attribute->name]['value'] = $attribute->type;
- $metadata['attribute_types'][$attribute->name]['required'] = $attribute->required;
- }
-
- /**
- * Annotations ::= Annotation {[ "*" ]* [Annotation]}*
- *
- * @throws AnnotationException
- * @throws ReflectionException
- *
- * @phpstan-return list<object>
- */
- private function Annotations(): array
- {
- $annotations = [];
-
- while ($this->lexer->lookahead !== null) {
- if ($this->lexer->lookahead['type'] !== DocLexer::T_AT) {
- $this->lexer->moveNext();
- continue;
- }
-
- // make sure the @ is preceded by non-catchable pattern
- if (
- $this->lexer->token !== null &&
- $this->lexer->lookahead['position'] === $this->lexer->token['position'] + strlen(
- $this->lexer->token['value']
- )
- ) {
- $this->lexer->moveNext();
- continue;
- }
-
- // make sure the @ is followed by either a namespace separator, or
- // an identifier token
- $peek = $this->lexer->glimpse();
- if (
- ($peek === null)
- || ($peek['type'] !== DocLexer::T_NAMESPACE_SEPARATOR && ! in_array(
- $peek['type'],
- self::$classIdentifiers,
- true
- ))
- || $peek['position'] !== $this->lexer->lookahead['position'] + 1
- ) {
- $this->lexer->moveNext();
- continue;
- }
-
- $this->isNestedAnnotation = false;
- $annot = $this->Annotation();
- if ($annot === false) {
- continue;
- }
-
- $annotations[] = $annot;
- }
-
- return $annotations;
- }
-
- /**
- * Annotation ::= "@" AnnotationName MethodCall
- * AnnotationName ::= QualifiedName | SimpleName
- * QualifiedName ::= NameSpacePart "\" {NameSpacePart "\"}* SimpleName
- * NameSpacePart ::= identifier | null | false | true
- * SimpleName ::= identifier | null | false | true
- *
- * @return object|false False if it is not a valid annotation.
- *
- * @throws AnnotationException
- * @throws ReflectionException
- */
- private function Annotation()
- {
- $this->match(DocLexer::T_AT);
-
- // check if we have an annotation
- $name = $this->Identifier();
-
- if (
- $this->lexer->isNextToken(DocLexer::T_MINUS)
- && $this->lexer->nextTokenIsAdjacent()
- ) {
- // Annotations with dashes, such as "@foo-" or "@foo-bar", are to be discarded
- return false;
- }
-
- // only process names which are not fully qualified, yet
- // fully qualified names must start with a \
- $originalName = $name;
-
- if ($name[0] !== '\\') {
- $pos = strpos($name, '\\');
- $alias = ($pos === false) ? $name : substr($name, 0, $pos);
- $found = false;
- $loweredAlias = strtolower($alias);
-
- if ($this->namespaces) {
- foreach ($this->namespaces as $namespace) {
- if ($this->classExists($namespace . '\\' . $name)) {
- $name = $namespace . '\\' . $name;
- $found = true;
- break;
- }
- }
- } elseif (isset($this->imports[$loweredAlias])) {
- $namespace = ltrim($this->imports[$loweredAlias], '\\');
- $name = ($pos !== false)
- ? $namespace . substr($name, $pos)
- : $namespace;
- $found = $this->classExists($name);
- } elseif (
- ! isset($this->ignoredAnnotationNames[$name])
- && isset($this->imports['__NAMESPACE__'])
- && $this->classExists($this->imports['__NAMESPACE__'] . '\\' . $name)
- ) {
- $name = $this->imports['__NAMESPACE__'] . '\\' . $name;
- $found = true;
- } elseif (! isset($this->ignoredAnnotationNames[$name]) && $this->classExists($name)) {
- $found = true;
- }
-
- if (! $found) {
- if ($this->isIgnoredAnnotation($name)) {
- return false;
- }
-
- throw AnnotationException::semanticalError(sprintf(
- <<<'EXCEPTION'
-The annotation "@%s" in %s was never imported. Did you maybe forget to add a "use" statement for this annotation?
-EXCEPTION
- ,
- $name,
- $this->context
- ));
- }
- }
-
- $name = ltrim($name, '\\');
-
- if (! $this->classExists($name)) {
- throw AnnotationException::semanticalError(sprintf(
- 'The annotation "@%s" in %s does not exist, or could not be auto-loaded.',
- $name,
- $this->context
- ));
- }
-
- // at this point, $name contains the fully qualified class name of the
- // annotation, and it is also guaranteed that this class exists, and
- // that it is loaded
-
- // collects the metadata annotation only if there is not yet
- if (! isset(self::$annotationMetadata[$name])) {
- $this->collectAnnotationMetadata($name);
- }
-
- // verify that the class is really meant to be an annotation and not just any ordinary class
- if (self::$annotationMetadata[$name]['is_annotation'] === false) {
- if ($this->isIgnoredAnnotation($originalName) || $this->isIgnoredAnnotation($name)) {
- return false;
- }
-
- throw AnnotationException::semanticalError(sprintf(
- <<<'EXCEPTION'
-The class "%s" is not annotated with @Annotation.
-Are you sure this class can be used as annotation?
-If so, then you need to add @Annotation to the _class_ doc comment of "%s".
-If it is indeed no annotation, then you need to add @IgnoreAnnotation("%s") to the _class_ doc comment of %s.
-EXCEPTION
- ,
- $name,
- $name,
- $originalName,
- $this->context
- ));
- }
-
- //if target is nested annotation
- $target = $this->isNestedAnnotation ? Target::TARGET_ANNOTATION : $this->target;
-
- // Next will be nested
- $this->isNestedAnnotation = true;
-
- //if annotation does not support current target
- if ((self::$annotationMetadata[$name]['targets'] & $target) === 0 && $target) {
- throw AnnotationException::semanticalError(
- sprintf(
- <<<'EXCEPTION'
-Annotation @%s is not allowed to be declared on %s. You may only use this annotation on these code elements: %s.
-EXCEPTION
- ,
- $originalName,
- $this->context,
- self::$annotationMetadata[$name]['targets_literal']
- )
- );
- }
-
- $arguments = $this->MethodCall();
- $values = $this->resolvePositionalValues($arguments, $name);
-
- if (isset(self::$annotationMetadata[$name]['enum'])) {
- // checks all declared attributes
- foreach (self::$annotationMetadata[$name]['enum'] as $property => $enum) {
- // checks if the attribute is a valid enumerator
- if (isset($values[$property]) && ! in_array($values[$property], $enum['value'])) {
- throw AnnotationException::enumeratorError(
- $property,
- $name,
- $this->context,
- $enum['literal'],
- $values[$property]
- );
- }
- }
- }
-
- // checks all declared attributes
- foreach (self::$annotationMetadata[$name]['attribute_types'] as $property => $type) {
- if (
- $property === self::$annotationMetadata[$name]['default_property']
- && ! isset($values[$property]) && isset($values['value'])
- ) {
- $property = 'value';
- }
-
- // handle a not given attribute or null value
- if (! isset($values[$property])) {
- if ($type['required']) {
- throw AnnotationException::requiredError(
- $property,
- $originalName,
- $this->context,
- 'a(n) ' . $type['value']
- );
- }
-
- continue;
- }
-
- if ($type['type'] === 'array') {
- // handle the case of a single value
- if (! is_array($values[$property])) {
- $values[$property] = [$values[$property]];
- }
-
- // checks if the attribute has array type declaration, such as "array<string>"
- if (isset($type['array_type'])) {
- foreach ($values[$property] as $item) {
- if (gettype($item) !== $type['array_type'] && ! $item instanceof $type['array_type']) {
- throw AnnotationException::attributeTypeError(
- $property,
- $originalName,
- $this->context,
- 'either a(n) ' . $type['array_type'] . ', or an array of ' . $type['array_type'] . 's',
- $item
- );
- }
- }
- }
- } elseif (gettype($values[$property]) !== $type['type'] && ! $values[$property] instanceof $type['type']) {
- throw AnnotationException::attributeTypeError(
- $property,
- $originalName,
- $this->context,
- 'a(n) ' . $type['value'],
- $values[$property]
- );
- }
- }
-
- if (self::$annotationMetadata[$name]['has_named_argument_constructor']) {
- if (PHP_VERSION_ID >= 80000) {
- return new $name(...$values);
- }
-
- $positionalValues = [];
- foreach (self::$annotationMetadata[$name]['constructor_args'] as $property => $parameter) {
- $positionalValues[$parameter['position']] = $parameter['default'];
- }
-
- foreach ($values as $property => $value) {
- if (! isset(self::$annotationMetadata[$name]['constructor_args'][$property])) {
- throw AnnotationException::creationError(sprintf(
- <<<'EXCEPTION'
-The annotation @%s declared on %s does not have a property named "%s"
-that can be set through its named arguments constructor.
-Available named arguments: %s
-EXCEPTION
- ,
- $originalName,
- $this->context,
- $property,
- implode(', ', array_keys(self::$annotationMetadata[$name]['constructor_args']))
- ));
- }
-
- $positionalValues[self::$annotationMetadata[$name]['constructor_args'][$property]['position']] = $value;
- }
-
- return new $name(...$positionalValues);
- }
-
- // check if the annotation expects values via the constructor,
- // or directly injected into public properties
- if (self::$annotationMetadata[$name]['has_constructor'] === true) {
- return new $name($values);
- }
-
- $instance = new $name();
-
- foreach ($values as $property => $value) {
- if (! isset(self::$annotationMetadata[$name]['properties'][$property])) {
- if ($property !== 'value') {
- throw AnnotationException::creationError(sprintf(
- <<<'EXCEPTION'
-The annotation @%s declared on %s does not have a property named "%s".
-Available properties: %s
-EXCEPTION
- ,
- $originalName,
- $this->context,
- $property,
- implode(', ', self::$annotationMetadata[$name]['properties'])
- ));
- }
-
- // handle the case if the property has no annotations
- $property = self::$annotationMetadata[$name]['default_property'];
- if (! $property) {
- throw AnnotationException::creationError(sprintf(
- 'The annotation @%s declared on %s does not accept any values, but got %s.',
- $originalName,
- $this->context,
- json_encode($values)
- ));
- }
- }
-
- $instance->{$property} = $value;
- }
-
- return $instance;
- }
-
- /**
- * MethodCall ::= ["(" [Values] ")"]
- *
- * @return mixed[]
- *
- * @throws AnnotationException
- * @throws ReflectionException
- */
- private function MethodCall(): array
- {
- $values = [];
-
- if (! $this->lexer->isNextToken(DocLexer::T_OPEN_PARENTHESIS)) {
- return $values;
- }
-
- $this->match(DocLexer::T_OPEN_PARENTHESIS);
-
- if (! $this->lexer->isNextToken(DocLexer::T_CLOSE_PARENTHESIS)) {
- $values = $this->Values();
- }
-
- $this->match(DocLexer::T_CLOSE_PARENTHESIS);
-
- return $values;
- }
-
- /**
- * Values ::= Array | Value {"," Value}* [","]
- *
- * @return mixed[]
- *
- * @throws AnnotationException
- * @throws ReflectionException
- */
- private function Values(): array
- {
- $values = [$this->Value()];
-
- while ($this->lexer->isNextToken(DocLexer::T_COMMA)) {
- $this->match(DocLexer::T_COMMA);
-
- if ($this->lexer->isNextToken(DocLexer::T_CLOSE_PARENTHESIS)) {
- break;
- }
-
- $token = $this->lexer->lookahead;
- $value = $this->Value();
-
- $values[] = $value;
- }
-
- $namedArguments = [];
- $positionalArguments = [];
- foreach ($values as $k => $value) {
- if (is_object($value) && $value instanceof stdClass) {
- $namedArguments[$value->name] = $value->value;
- } else {
- $positionalArguments[$k] = $value;
- }
- }
-
- return ['named_arguments' => $namedArguments, 'positional_arguments' => $positionalArguments];
- }
-
- /**
- * Constant ::= integer | string | float | boolean
- *
- * @return mixed
- *
- * @throws AnnotationException
- */
- private function Constant()
- {
- $identifier = $this->Identifier();
-
- if (! defined($identifier) && strpos($identifier, '::') !== false && $identifier[0] !== '\\') {
- [$className, $const] = explode('::', $identifier);
-
- $pos = strpos($className, '\\');
- $alias = ($pos === false) ? $className : substr($className, 0, $pos);
- $found = false;
- $loweredAlias = strtolower($alias);
-
- switch (true) {
- case ! empty($this->namespaces):
- foreach ($this->namespaces as $ns) {
- if (class_exists($ns . '\\' . $className) || interface_exists($ns . '\\' . $className)) {
- $className = $ns . '\\' . $className;
- $found = true;
- break;
- }
- }
-
- break;
-
- case isset($this->imports[$loweredAlias]):
- $found = true;
- $className = ($pos !== false)
- ? $this->imports[$loweredAlias] . substr($className, $pos)
- : $this->imports[$loweredAlias];
- break;
-
- default:
- if (isset($this->imports['__NAMESPACE__'])) {
- $ns = $this->imports['__NAMESPACE__'];
-
- if (class_exists($ns . '\\' . $className) || interface_exists($ns . '\\' . $className)) {
- $className = $ns . '\\' . $className;
- $found = true;
- }
- }
-
- break;
- }
-
- if ($found) {
- $identifier = $className . '::' . $const;
- }
- }
-
- /**
- * Checks if identifier ends with ::class and remove the leading backslash if it exists.
- */
- if (
- $this->identifierEndsWithClassConstant($identifier) &&
- ! $this->identifierStartsWithBackslash($identifier)
- ) {
- return substr($identifier, 0, $this->getClassConstantPositionInIdentifier($identifier));
- }
-
- if ($this->identifierEndsWithClassConstant($identifier) && $this->identifierStartsWithBackslash($identifier)) {
- return substr($identifier, 1, $this->getClassConstantPositionInIdentifier($identifier) - 1);
- }
-
- if (! defined($identifier)) {
- throw AnnotationException::semanticalErrorConstants($identifier, $this->context);
- }
-
- return constant($identifier);
- }
-
- private function identifierStartsWithBackslash(string $identifier): bool
- {
- return $identifier[0] === '\\';
- }
-
- private function identifierEndsWithClassConstant(string $identifier): bool
- {
- return $this->getClassConstantPositionInIdentifier($identifier) === strlen($identifier) - strlen('::class');
- }
-
- /**
- * @return int|false
- */
- private function getClassConstantPositionInIdentifier(string $identifier)
- {
- return stripos($identifier, '::class');
- }
-
- /**
- * Identifier ::= string
- *
- * @throws AnnotationException
- */
- private function Identifier(): string
- {
- // check if we have an annotation
- if (! $this->lexer->isNextTokenAny(self::$classIdentifiers)) {
- throw $this->syntaxError('namespace separator or identifier');
- }
-
- $this->lexer->moveNext();
-
- $className = $this->lexer->token['value'];
-
- while (
- $this->lexer->lookahead !== null &&
- $this->lexer->lookahead['position'] === ($this->lexer->token['position'] +
- strlen($this->lexer->token['value'])) &&
- $this->lexer->isNextToken(DocLexer::T_NAMESPACE_SEPARATOR)
- ) {
- $this->match(DocLexer::T_NAMESPACE_SEPARATOR);
- $this->matchAny(self::$classIdentifiers);
-
- $className .= '\\' . $this->lexer->token['value'];
- }
-
- return $className;
- }
-
- /**
- * Value ::= PlainValue | FieldAssignment
- *
- * @return mixed
- *
- * @throws AnnotationException
- * @throws ReflectionException
- */
- private function Value()
- {
- $peek = $this->lexer->glimpse();
-
- if ($peek['type'] === DocLexer::T_EQUALS) {
- return $this->FieldAssignment();
- }
-
- return $this->PlainValue();
- }
-
- /**
- * PlainValue ::= integer | string | float | boolean | Array | Annotation
- *
- * @return mixed
- *
- * @throws AnnotationException
- * @throws ReflectionException
- */
- private function PlainValue()
- {
- if ($this->lexer->isNextToken(DocLexer::T_OPEN_CURLY_BRACES)) {
- return $this->Arrayx();
- }
-
- if ($this->lexer->isNextToken(DocLexer::T_AT)) {
- return $this->Annotation();
- }
-
- if ($this->lexer->isNextToken(DocLexer::T_IDENTIFIER)) {
- return $this->Constant();
- }
-
- switch ($this->lexer->lookahead['type']) {
- case DocLexer::T_STRING:
- $this->match(DocLexer::T_STRING);
-
- return $this->lexer->token['value'];
-
- case DocLexer::T_INTEGER:
- $this->match(DocLexer::T_INTEGER);
-
- return (int) $this->lexer->token['value'];
-
- case DocLexer::T_FLOAT:
- $this->match(DocLexer::T_FLOAT);
-
- return (float) $this->lexer->token['value'];
-
- case DocLexer::T_TRUE:
- $this->match(DocLexer::T_TRUE);
-
- return true;
-
- case DocLexer::T_FALSE:
- $this->match(DocLexer::T_FALSE);
-
- return false;
-
- case DocLexer::T_NULL:
- $this->match(DocLexer::T_NULL);
-
- return null;
-
- default:
- throw $this->syntaxError('PlainValue');
- }
- }
-
- /**
- * FieldAssignment ::= FieldName "=" PlainValue
- * FieldName ::= identifier
- *
- * @throws AnnotationException
- * @throws ReflectionException
- */
- private function FieldAssignment(): stdClass
- {
- $this->match(DocLexer::T_IDENTIFIER);
- $fieldName = $this->lexer->token['value'];
-
- $this->match(DocLexer::T_EQUALS);
-
- $item = new stdClass();
- $item->name = $fieldName;
- $item->value = $this->PlainValue();
-
- return $item;
- }
-
- /**
- * Array ::= "{" ArrayEntry {"," ArrayEntry}* [","] "}"
- *
- * @return mixed[]
- *
- * @throws AnnotationException
- * @throws ReflectionException
- */
- private function Arrayx(): array
- {
- $array = $values = [];
-
- $this->match(DocLexer::T_OPEN_CURLY_BRACES);
-
- // If the array is empty, stop parsing and return.
- if ($this->lexer->isNextToken(DocLexer::T_CLOSE_CURLY_BRACES)) {
- $this->match(DocLexer::T_CLOSE_CURLY_BRACES);
-
- return $array;
- }
-
- $values[] = $this->ArrayEntry();
-
- while ($this->lexer->isNextToken(DocLexer::T_COMMA)) {
- $this->match(DocLexer::T_COMMA);
-
- // optional trailing comma
- if ($this->lexer->isNextToken(DocLexer::T_CLOSE_CURLY_BRACES)) {
- break;
- }
-
- $values[] = $this->ArrayEntry();
- }
-
- $this->match(DocLexer::T_CLOSE_CURLY_BRACES);
-
- foreach ($values as $value) {
- [$key, $val] = $value;
-
- if ($key !== null) {
- $array[$key] = $val;
- } else {
- $array[] = $val;
- }
- }
-
- return $array;
- }
-
- /**
- * ArrayEntry ::= Value | KeyValuePair
- * KeyValuePair ::= Key ("=" | ":") PlainValue | Constant
- * Key ::= string | integer | Constant
- *
- * @throws AnnotationException
- * @throws ReflectionException
- *
- * @phpstan-return array{mixed, mixed}
- */
- private function ArrayEntry(): array
- {
- $peek = $this->lexer->glimpse();
-
- if (
- $peek['type'] === DocLexer::T_EQUALS
- || $peek['type'] === DocLexer::T_COLON
- ) {
- if ($this->lexer->isNextToken(DocLexer::T_IDENTIFIER)) {
- $key = $this->Constant();
- } else {
- $this->matchAny([DocLexer::T_INTEGER, DocLexer::T_STRING]);
- $key = $this->lexer->token['value'];
- }
-
- $this->matchAny([DocLexer::T_EQUALS, DocLexer::T_COLON]);
-
- return [$key, $this->PlainValue()];
- }
-
- return [null, $this->Value()];
- }
-
- /**
- * Checks whether the given $name matches any ignored annotation name or namespace
- */
- private function isIgnoredAnnotation(string $name): bool
- {
- if ($this->ignoreNotImportedAnnotations || isset($this->ignoredAnnotationNames[$name])) {
- return true;
- }
-
- foreach (array_keys($this->ignoredAnnotationNamespaces) as $ignoredAnnotationNamespace) {
- $ignoredAnnotationNamespace = rtrim($ignoredAnnotationNamespace, '\\') . '\\';
-
- if (stripos(rtrim($name, '\\') . '\\', $ignoredAnnotationNamespace) === 0) {
- return true;
- }
- }
-
- return false;
- }
-
- /**
- * Resolve positional arguments (without name) to named ones
- *
- * @param array<string,mixed> $arguments
- *
- * @return array<string,mixed>
- */
- private function resolvePositionalValues(array $arguments, string $name): array
- {
- $positionalArguments = $arguments['positional_arguments'] ?? [];
- $values = $arguments['named_arguments'] ?? [];
-
- if (
- self::$annotationMetadata[$name]['has_named_argument_constructor']
- && self::$annotationMetadata[$name]['default_property'] !== null
- ) {
- // We must ensure that we don't have positional arguments after named ones
- $positions = array_keys($positionalArguments);
- $lastPosition = null;
- foreach ($positions as $position) {
- if (
- ($lastPosition === null && $position !== 0) ||
- ($lastPosition !== null && $position !== $lastPosition + 1)
- ) {
- throw $this->syntaxError('Positional arguments after named arguments is not allowed');
- }
-
- $lastPosition = $position;
- }
-
- foreach (self::$annotationMetadata[$name]['constructor_args'] as $property => $parameter) {
- $position = $parameter['position'];
- if (isset($values[$property]) || ! isset($positionalArguments[$position])) {
- continue;
- }
-
- $values[$property] = $positionalArguments[$position];
- }
- } else {
- if (count($positionalArguments) > 0 && ! isset($values['value'])) {
- if (count($positionalArguments) === 1) {
- $value = array_pop($positionalArguments);
- } else {
- $value = array_values($positionalArguments);
- }
-
- $values['value'] = $value;
- }
- }
-
- return $values;
- }
-}
diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/FileCacheReader.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/FileCacheReader.php
deleted file mode 100644
index e6a7a95..0000000
--- a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/FileCacheReader.php
+++ /dev/null
@@ -1,315 +0,0 @@
-<?php
-
-namespace Doctrine\Common\Annotations;
-
-use InvalidArgumentException;
-use ReflectionClass;
-use ReflectionMethod;
-use ReflectionProperty;
-use RuntimeException;
-
-use function chmod;
-use function file_put_contents;
-use function filemtime;
-use function gettype;
-use function is_dir;
-use function is_file;
-use function is_int;
-use function is_writable;
-use function mkdir;
-use function rename;
-use function rtrim;
-use function serialize;
-use function sha1;
-use function sprintf;
-use function strtr;
-use function tempnam;
-use function uniqid;
-use function unlink;
-use function var_export;
-
-/**
- * File cache reader for annotations.
- *
- * @deprecated the FileCacheReader is deprecated and will be removed
- * in version 2.0.0 of doctrine/annotations. Please use the
- * {@see \Doctrine\Common\Annotations\CachedReader} instead.
- */
-class FileCacheReader implements Reader
-{
- /** @var Reader */
- private $reader;
-
- /** @var string */
- private $dir;
-
- /** @var bool */
- private $debug;
-
- /** @phpstan-var array<string, list<object>> */
- private $loadedAnnotations = [];
-
- /** @var array<string, string> */
- private $classNameHashes = [];
-
- /** @var int */
- private $umask;
-
- /**
- * @param string $cacheDir
- * @param bool $debug
- * @param int $umask
- *
- * @throws InvalidArgumentException
- */
- public function __construct(Reader $reader, $cacheDir, $debug = false, $umask = 0002)
- {
- if (! is_int($umask)) {
- throw new InvalidArgumentException(sprintf(
- 'The parameter umask must be an integer, was: %s',
- gettype($umask)
- ));
- }
-
- $this->reader = $reader;
- $this->umask = $umask;
-
- if (! is_dir($cacheDir) && ! @mkdir($cacheDir, 0777 & (~$this->umask), true)) {
- throw new InvalidArgumentException(sprintf(
- 'The directory "%s" does not exist and could not be created.',
- $cacheDir
- ));
- }
-
- $this->dir = rtrim($cacheDir, '\\/');
- $this->debug = $debug;
- }
-
- /**
- * {@inheritDoc}
- */
- public function getClassAnnotations(ReflectionClass $class)
- {
- if (! isset($this->classNameHashes[$class->name])) {
- $this->classNameHashes[$class->name] = sha1($class->name);
- }
-
- $key = $this->classNameHashes[$class->name];
-
- if (isset($this->loadedAnnotations[$key])) {
- return $this->loadedAnnotations[$key];
- }
-
- $path = $this->dir . '/' . strtr($key, '\\', '-') . '.cache.php';
- if (! is_file($path)) {
- $annot = $this->reader->getClassAnnotations($class);
- $this->saveCacheFile($path, $annot);
-
- return $this->loadedAnnotations[$key] = $annot;
- }
-
- $filename = $class->getFilename();
- if (
- $this->debug
- && $filename !== false
- && filemtime($path) < filemtime($filename)
- ) {
- @unlink($path);
-
- $annot = $this->reader->getClassAnnotations($class);
- $this->saveCacheFile($path, $annot);
-
- return $this->loadedAnnotations[$key] = $annot;
- }
-
- return $this->loadedAnnotations[$key] = include $path;
- }
-
- /**
- * {@inheritDoc}
- */
- public function getPropertyAnnotations(ReflectionProperty $property)
- {
- $class = $property->getDeclaringClass();
- if (! isset($this->classNameHashes[$class->name])) {
- $this->classNameHashes[$class->name] = sha1($class->name);
- }
-
- $key = $this->classNameHashes[$class->name] . '$' . $property->getName();
-
- if (isset($this->loadedAnnotations[$key])) {
- return $this->loadedAnnotations[$key];
- }
-
- $path = $this->dir . '/' . strtr($key, '\\', '-') . '.cache.php';
- if (! is_file($path)) {
- $annot = $this->reader->getPropertyAnnotations($property);
- $this->saveCacheFile($path, $annot);
-
- return $this->loadedAnnotations[$key] = $annot;
- }
-
- $filename = $class->getFilename();
- if (
- $this->debug
- && $filename !== false
- && filemtime($path) < filemtime($filename)
- ) {
- @unlink($path);
-
- $annot = $this->reader->getPropertyAnnotations($property);
- $this->saveCacheFile($path, $annot);
-
- return $this->loadedAnnotations[$key] = $annot;
- }
-
- return $this->loadedAnnotations[$key] = include $path;
- }
-
- /**
- * {@inheritDoc}
- */
- public function getMethodAnnotations(ReflectionMethod $method)
- {
- $class = $method->getDeclaringClass();
- if (! isset($this->classNameHashes[$class->name])) {
- $this->classNameHashes[$class->name] = sha1($class->name);
- }
-
- $key = $this->classNameHashes[$class->name] . '#' . $method->getName();
-
- if (isset($this->loadedAnnotations[$key])) {
- return $this->loadedAnnotations[$key];
- }
-
- $path = $this->dir . '/' . strtr($key, '\\', '-') . '.cache.php';
- if (! is_file($path)) {
- $annot = $this->reader->getMethodAnnotations($method);
- $this->saveCacheFile($path, $annot);
-
- return $this->loadedAnnotations[$key] = $annot;
- }
-
- $filename = $class->getFilename();
- if (
- $this->debug
- && $filename !== false
- && filemtime($path) < filemtime($filename)
- ) {
- @unlink($path);
-
- $annot = $this->reader->getMethodAnnotations($method);
- $this->saveCacheFile($path, $annot);
-
- return $this->loadedAnnotations[$key] = $annot;
- }
-
- return $this->loadedAnnotations[$key] = include $path;
- }
-
- /**
- * Saves the cache file.
- *
- * @param string $path
- * @param mixed $data
- *
- * @return void
- */
- private function saveCacheFile($path, $data)
- {
- if (! is_writable($this->dir)) {
- throw new InvalidArgumentException(sprintf(
- <<<'EXCEPTION'
-The directory "%s" is not writable. Both the webserver and the console user need access.
-You can manage access rights for multiple users with "chmod +a".
-If your system does not support this, check out the acl package.,
-EXCEPTION
- ,
- $this->dir
- ));
- }
-
- $tempfile = tempnam($this->dir, uniqid('', true));
-
- if ($tempfile === false) {
- throw new RuntimeException(sprintf('Unable to create tempfile in directory: %s', $this->dir));
- }
-
- @chmod($tempfile, 0666 & (~$this->umask));
-
- $written = file_put_contents(
- $tempfile,
- '<?php return unserialize(' . var_export(serialize($data), true) . ');'
- );
-
- if ($written === false) {
- throw new RuntimeException(sprintf('Unable to write cached file to: %s', $tempfile));
- }
-
- @chmod($tempfile, 0666 & (~$this->umask));
-
- if (rename($tempfile, $path) === false) {
- @unlink($tempfile);
-
- throw new RuntimeException(sprintf('Unable to rename %s to %s', $tempfile, $path));
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public function getClassAnnotation(ReflectionClass $class, $annotationName)
- {
- $annotations = $this->getClassAnnotations($class);
-
- foreach ($annotations as $annotation) {
- if ($annotation instanceof $annotationName) {
- return $annotation;
- }
- }
-
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- public function getMethodAnnotation(ReflectionMethod $method, $annotationName)
- {
- $annotations = $this->getMethodAnnotations($method);
-
- foreach ($annotations as $annotation) {
- if ($annotation instanceof $annotationName) {
- return $annotation;
- }
- }
-
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- public function getPropertyAnnotation(ReflectionProperty $property, $annotationName)
- {
- $annotations = $this->getPropertyAnnotations($property);
-
- foreach ($annotations as $annotation) {
- if ($annotation instanceof $annotationName) {
- return $annotation;
- }
- }
-
- return null;
- }
-
- /**
- * Clears loaded annotations.
- *
- * @return void
- */
- public function clearLoadedAnnotations()
- {
- $this->loadedAnnotations = [];
- }
-}
diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/ImplicitlyIgnoredAnnotationNames.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/ImplicitlyIgnoredAnnotationNames.php
deleted file mode 100644
index 52b929d..0000000
--- a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/ImplicitlyIgnoredAnnotationNames.php
+++ /dev/null
@@ -1,171 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-namespace Doctrine\Common\Annotations;
-
-/**
- * A list of annotations that are implicitly ignored during the parsing process.
- *
- * All names are case sensitive.
- */
-final class ImplicitlyIgnoredAnnotationNames
-{
- private const Reserved = [
- 'Annotation' => true,
- 'Attribute' => true,
- 'Attributes' => true,
- /* Can we enable this? 'Enum' => true, */
- 'Required' => true,
- 'Target' => true,
- ];
-
- private const WidelyUsedNonStandard = [
- 'fix' => true,
- 'fixme' => true,
- 'override' => true,
- ];
-
- private const PhpDocumentor1 = [
- 'abstract' => true,
- 'access' => true,
- 'code' => true,
- 'deprec' => true,
- 'endcode' => true,
- 'exception' => true,
- 'final' => true,
- 'ingroup' => true,
- 'inheritdoc' => true,
- 'inheritDoc' => true,
- 'magic' => true,
- 'name' => true,
- 'private' => true,
- 'static' => true,
- 'staticvar' => true,
- 'staticVar' => true,
- 'toc' => true,
- 'tutorial' => true,
- 'throw' => true,
- ];
-
- private const PhpDocumentor2 = [
- 'api' => true,
- 'author' => true,
- 'category' => true,
- 'copyright' => true,
- 'deprecated' => true,
- 'example' => true,
- 'filesource' => true,
- 'global' => true,
- 'ignore' => true,
- /* Can we enable this? 'index' => true, */
- 'internal' => true,
- 'license' => true,
- 'link' => true,
- 'method' => true,
- 'package' => true,
- 'param' => true,
- 'property' => true,
- 'property-read' => true,
- 'property-write' => true,
- 'return' => true,
- 'see' => true,
- 'since' => true,
- 'source' => true,
- 'subpackage' => true,
- 'throws' => true,
- 'todo' => true,
- 'TODO' => true,
- 'usedby' => true,
- 'uses' => true,
- 'var' => true,
- 'version' => true,
- ];
-
- private const PHPUnit = [
- 'author' => true,
- 'after' => true,
- 'afterClass' => true,
- 'backupGlobals' => true,
- 'backupStaticAttributes' => true,
- 'before' => true,
- 'beforeClass' => true,
- 'codeCoverageIgnore' => true,
- 'codeCoverageIgnoreStart' => true,
- 'codeCoverageIgnoreEnd' => true,
- 'covers' => true,
- 'coversDefaultClass' => true,
- 'coversNothing' => true,
- 'dataProvider' => true,
- 'depends' => true,
- 'doesNotPerformAssertions' => true,
- 'expectedException' => true,
- 'expectedExceptionCode' => true,
- 'expectedExceptionMessage' => true,
- 'expectedExceptionMessageRegExp' => true,
- 'group' => true,
- 'large' => true,
- 'medium' => true,
- 'preserveGlobalState' => true,
- 'requires' => true,
- 'runTestsInSeparateProcesses' => true,
- 'runInSeparateProcess' => true,
- 'small' => true,
- 'test' => true,
- 'testdox' => true,
- 'testWith' => true,
- 'ticket' => true,
- 'uses' => true,
- ];
-
- private const PhpCheckStyle = ['SuppressWarnings' => true];
-
- private const PhpStorm = ['noinspection' => true];
-
- private const PEAR = ['package_version' => true];
-
- private const PlainUML = [
- 'startuml' => true,
- 'enduml' => true,
- ];
-
- private const Symfony = ['experimental' => true];
-
- private const PhpCodeSniffer = [
- 'codingStandardsIgnoreStart' => true,
- 'codingStandardsIgnoreEnd' => true,
- ];
-
- private const SlevomatCodingStandard = ['phpcsSuppress' => true];
-
- private const PhpStan = [
- 'extends' => true,
- 'implements' => true,
- 'template' => true,
- 'use' => true,
- ];
-
- private const Phan = ['suppress' => true];
-
- private const Rector = ['noRector' => true];
-
- public const LIST = self::Reserved
- + self::WidelyUsedNonStandard
- + self::PhpDocumentor1
- + self::PhpDocumentor2
- + self::PHPUnit
- + self::PhpCheckStyle
- + self::PhpStorm
- + self::PEAR
- + self::PlainUML
- + self::Symfony
- + self::SlevomatCodingStandard
- + self::PhpCodeSniffer
- + self::PhpStan
- + self::Phan
- + self::Rector;
-
- private function __construct()
- {
- }
-}
diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/IndexedReader.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/IndexedReader.php
deleted file mode 100644
index 42e7076..0000000
--- a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/IndexedReader.php
+++ /dev/null
@@ -1,100 +0,0 @@
-<?php
-
-namespace Doctrine\Common\Annotations;
-
-use ReflectionClass;
-use ReflectionMethod;
-use ReflectionProperty;
-
-use function call_user_func_array;
-use function get_class;
-
-/**
- * Allows the reader to be used in-place of Doctrine's reader.
- */
-class IndexedReader implements Reader
-{
- /** @var Reader */
- private $delegate;
-
- public function __construct(Reader $reader)
- {
- $this->delegate = $reader;
- }
-
- /**
- * {@inheritDoc}
- */
- public function getClassAnnotations(ReflectionClass $class)
- {
- $annotations = [];
- foreach ($this->delegate->getClassAnnotations($class) as $annot) {
- $annotations[get_class($annot)] = $annot;
- }
-
- return $annotations;
- }
-
- /**
- * {@inheritDoc}
- */
- public function getClassAnnotation(ReflectionClass $class, $annotation)
- {
- return $this->delegate->getClassAnnotation($class, $annotation);
- }
-
- /**
- * {@inheritDoc}
- */
- public function getMethodAnnotations(ReflectionMethod $method)
- {
- $annotations = [];
- foreach ($this->delegate->getMethodAnnotations($method) as $annot) {
- $annotations[get_class($annot)] = $annot;
- }
-
- return $annotations;
- }
-
- /**
- * {@inheritDoc}
- */
- public function getMethodAnnotation(ReflectionMethod $method, $annotation)
- {
- return $this->delegate->getMethodAnnotation($method, $annotation);
- }
-
- /**
- * {@inheritDoc}
- */
- public function getPropertyAnnotations(ReflectionProperty $property)
- {
- $annotations = [];
- foreach ($this->delegate->getPropertyAnnotations($property) as $annot) {
- $annotations[get_class($annot)] = $annot;
- }
-
- return $annotations;
- }
-
- /**
- * {@inheritDoc}
- */
- public function getPropertyAnnotation(ReflectionProperty $property, $annotation)
- {
- return $this->delegate->getPropertyAnnotation($property, $annotation);
- }
-
- /**
- * Proxies all methods to the delegate.
- *
- * @param string $method
- * @param mixed[] $args
- *
- * @return mixed
- */
- public function __call($method, $args)
- {
- return call_user_func_array([$this->delegate, $method], $args);
- }
-}
diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/NamedArgumentConstructorAnnotation.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/NamedArgumentConstructorAnnotation.php
deleted file mode 100644
index 8af224c..0000000
--- a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/NamedArgumentConstructorAnnotation.php
+++ /dev/null
@@ -1,14 +0,0 @@
-<?php
-
-namespace Doctrine\Common\Annotations;
-
-/**
- * Marker interface for PHP7/PHP8 compatible support
- * for named arguments (and constructor property promotion).
- *
- * @deprecated Implementing this interface is deprecated
- * Use the Annotation @NamedArgumentConstructor instead
- */
-interface NamedArgumentConstructorAnnotation
-{
-}
diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/PhpParser.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/PhpParser.php
deleted file mode 100644
index d2263c0..0000000
--- a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/PhpParser.php
+++ /dev/null
@@ -1,92 +0,0 @@
-<?php
-
-namespace Doctrine\Common\Annotations;
-
-use ReflectionClass;
-use ReflectionFunction;
-use SplFileObject;
-
-use function is_file;
-use function method_exists;
-use function preg_quote;
-use function preg_replace;
-
-/**
- * Parses a file for namespaces/use/class declarations.
- */
-final class PhpParser
-{
- /**
- * Parses a class.
- *
- * @deprecated use parseUseStatements instead
- *
- * @param ReflectionClass $class A <code>ReflectionClass</code> object.
- *
- * @return array<string, class-string> A list with use statements in the form (Alias => FQN).
- */
- public function parseClass(ReflectionClass $class)
- {
- return $this->parseUseStatements($class);
- }
-
- /**
- * Parse a class or function for use statements.
- *
- * @param ReflectionClass|ReflectionFunction $reflection
- *
- * @psalm-return array<string, string> a list with use statements in the form (Alias => FQN).
- */
- public function parseUseStatements($reflection): array
- {
- if (method_exists($reflection, 'getUseStatements')) {
- return $reflection->getUseStatements();
- }
-
- $filename = $reflection->getFileName();
-
- if ($filename === false) {
- return [];
- }
-
- $content = $this->getFileContent($filename, $reflection->getStartLine());
-
- if ($content === null) {
- return [];
- }
-
- $namespace = preg_quote($reflection->getNamespaceName());
- $content = preg_replace('/^.*?(\bnamespace\s+' . $namespace . '\s*[;{].*)$/s', '\\1', $content);
- $tokenizer = new TokenParser('<?php ' . $content);
-
- return $tokenizer->parseUseStatements($reflection->getNamespaceName());
- }
-
- /**
- * Gets the content of the file right up to the given line number.
- *
- * @param string $filename The name of the file to load.
- * @param int $lineNumber The number of lines to read from file.
- *
- * @return string|null The content of the file or null if the file does not exist.
- */
- private function getFileContent($filename, $lineNumber)
- {
- if (! is_file($filename)) {
- return null;
- }
-
- $content = '';
- $lineCnt = 0;
- $file = new SplFileObject($filename);
- while (! $file->eof()) {
- if ($lineCnt++ === $lineNumber) {
- break;
- }
-
- $content .= $file->fgets();
- }
-
- return $content;
- }
-}
diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Reader.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Reader.php
deleted file mode 100644
index 0663ffd..0000000
--- a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/Reader.php
+++ /dev/null
@@ -1,80 +0,0 @@
-<?php
-
-namespace Doctrine\Common\Annotations;
-
-use ReflectionClass;
-use ReflectionMethod;
-use ReflectionProperty;
-
-/**
- * Interface for annotation readers.
- */
-interface Reader
-{
- /**
- * Gets the annotations applied to a class.
- *
- * @param ReflectionClass $class The ReflectionClass of the class from which
- * the class annotations should be read.
- *
- * @return array<object> An array of Annotations.
- */
- public function getClassAnnotations(ReflectionClass $class);
-
- /**
- * Gets a class annotation.
- *
- * @param ReflectionClass $class The ReflectionClass of the class from which
- * the class annotations should be read.
- * @param class-string<T> $annotationName The name of the annotation.
- *
- * @return T|null The Annotation or NULL, if the requested annotation does not exist.
- *
- * @template T
- */
- public function getClassAnnotation(ReflectionClass $class, $annotationName);
-
- /**
- * Gets the annotations applied to a method.
- *
- * @param ReflectionMethod $method The ReflectionMethod of the method from which
- * the annotations should be read.
- *
- * @return array<object> An array of Annotations.
- */
- public function getMethodAnnotations(ReflectionMethod $method);
-
- /**
- * Gets a method annotation.
- *
- * @param ReflectionMethod $method The ReflectionMethod to read the annotations from.
- * @param class-string<T> $annotationName The name of the annotation.
- *
- * @return T|null The Annotation or NULL, if the requested annotation does not exist.
- *
- * @template T
- */
- public function getMethodAnnotation(ReflectionMethod $method, $annotationName);
-
- /**
- * Gets the annotations applied to a property.
- *
- * @param ReflectionProperty $property The ReflectionProperty of the property
- * from which the annotations should be read.
- *
- * @return array<object> An array of Annotations.
- */
- public function getPropertyAnnotations(ReflectionProperty $property);
-
- /**
- * Gets a property annotation.
- *
- * @param ReflectionProperty $property The ReflectionProperty to read the annotations from.
- * @param class-string<T> $annotationName The name of the annotation.
- *
- * @return T|null The Annotation or NULL, if the requested annotation does not exist.
- *
- * @template T
- */
- public function getPropertyAnnotation(ReflectionProperty $property, $annotationName);
-}
diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/SimpleAnnotationReader.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/SimpleAnnotationReader.php
deleted file mode 100644
index 8a78c11..0000000
--- a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/SimpleAnnotationReader.php
+++ /dev/null
@@ -1,114 +0,0 @@
-<?php
-
-namespace Doctrine\Common\Annotations;
-
-use ReflectionClass;
-use ReflectionMethod;
-use ReflectionProperty;
-
-/**
- * Simple Annotation Reader.
- *
- * This annotation reader is intended to be used in projects where you have
- * full-control over all annotations that are available.
- *
- * @deprecated Deprecated in favour of using AnnotationReader
- */
-class SimpleAnnotationReader implements Reader
-{
- /** @var DocParser */
- private $parser;
-
- /**
- * Initializes a new SimpleAnnotationReader.
- */
- public function __construct()
- {
- $this->parser = new DocParser();
- $this->parser->setIgnoreNotImportedAnnotations(true);
- }
-
- /**
- * Adds a namespace in which we will look for annotations.
- *
- * @param string $namespace
- *
- * @return void
- */
- public function addNamespace($namespace)
- {
- $this->parser->addNamespace($namespace);
- }
-
- /**
- * {@inheritDoc}
- */
- public function getClassAnnotations(ReflectionClass $class)
- {
- return $this->parser->parse($class->getDocComment(), 'class ' . $class->getName());
- }
-
- /**
- * {@inheritDoc}
- */
- public function getMethodAnnotations(ReflectionMethod $method)
- {
- return $this->parser->parse(
- $method->getDocComment(),
- 'method ' . $method->getDeclaringClass()->name . '::' . $method->getName() . '()'
- );
- }
-
- /**
- * {@inheritDoc}
- */
- public function getPropertyAnnotations(ReflectionProperty $property)
- {
- return $this->parser->parse(
- $property->getDocComment(),
- 'property ' . $property->getDeclaringClass()->name . '::$' . $property->getName()
- );
- }
-
- /**
- * {@inheritDoc}
- */
- public function getClassAnnotation(ReflectionClass $class, $annotationName)
- {
- foreach ($this->getClassAnnotations($class) as $annot) {
- if ($annot instanceof $annotationName) {
- return $annot;
- }
- }
-
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- public function getMethodAnnotation(ReflectionMethod $method, $annotationName)
- {
- foreach ($this->getMethodAnnotations($method) as $annot) {
- if ($annot instanceof $annotationName) {
- return $annot;
- }
- }
-
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- public function getPropertyAnnotation(ReflectionProperty $property, $annotationName)
- {
- foreach ($this->getPropertyAnnotations($property) as $annot) {
- if ($annot instanceof $annotationName) {
- return $annot;
- }
- }
-
- return null;
- }
-}
diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/TokenParser.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/TokenParser.php
deleted file mode 100644
index 9605fb8..0000000
--- a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/TokenParser.php
+++ /dev/null
@@ -1,208 +0,0 @@
-<?php
-
-namespace Doctrine\Common\Annotations;
-
-use function array_merge;
-use function count;
-use function explode;
-use function strtolower;
-use function token_get_all;
-
-use const PHP_VERSION_ID;
-use const T_AS;
-use const T_COMMENT;
-use const T_DOC_COMMENT;
-use const T_NAME_FULLY_QUALIFIED;
-use const T_NAME_QUALIFIED;
-use const T_NAMESPACE;
-use const T_NS_SEPARATOR;
-use const T_STRING;
-use const T_USE;
-use const T_WHITESPACE;
-
-/**
- * Parses a file for namespaces/use/class declarations.
- */
-class TokenParser
-{
- /**
- * The token list.
- *
- * @phpstan-var list<mixed[]>
- */
- private $tokens;
-
- /**
- * The number of tokens.
- *
- * @var int
- */
- private $numTokens;
-
- /**
- * The current array pointer.
- *
- * @var int
- */
- private $pointer = 0;
-
- /**
- * @param string $contents
- */
- public function __construct($contents)
- {
- $this->tokens = token_get_all($contents);
-
- // The PHP parser sets internal compiler globals for certain things. Annoyingly, the last docblock comment it
- // saw gets stored in doc_comment. When it comes to compile the next thing to be include()d this stored
- // doc_comment becomes owned by the first thing the compiler sees in the file that it considers might have a
- // docblock. If the first thing in the file is a class without a doc block this would cause calls to
- // getDocBlock() on said class to return our long lost doc_comment. Argh.
- // To workaround, cause the parser to parse an empty docblock. Sure getDocBlock() will return this, but at least
- // it's harmless to us.
- token_get_all("<?php\n/**\n *\n */");
-
- $this->numTokens = count($this->tokens);
- }
-
- /**
- * Gets the next non whitespace and non comment token.
- *
- * @param bool $docCommentIsComment If TRUE then a doc comment is considered a comment and skipped.
- * If FALSE then only whitespace and normal comments are skipped.
- *
- * @return mixed[]|string|null The token if exists, null otherwise.
- */
- public function next($docCommentIsComment = true)
- {
- for ($i = $this->pointer; $i < $this->numTokens; $i++) {
- $this->pointer++;
- if (
- $this->tokens[$i][0] === T_WHITESPACE ||
- $this->tokens[$i][0] === T_COMMENT ||
- ($docCommentIsComment && $this->tokens[$i][0] === T_DOC_COMMENT)
- ) {
- continue;
- }
-
- return $this->tokens[$i];
- }
-
- return null;
- }
-
- /**
- * Parses a single use statement.
- *
- * @return array<string, string> A list with all found class names for a use statement.
- */
- public function parseUseStatement()
- {
- $groupRoot = '';
- $class = '';
- $alias = '';
- $statements = [];
- $explicitAlias = false;
- while (($token = $this->next())) {
- if (! $explicitAlias && $token[0] === T_STRING) {
- $class .= $token[1];
- $alias = $token[1];
- } elseif ($explicitAlias && $token[0] === T_STRING) {
- $alias = $token[1];
- } elseif (
- PHP_VERSION_ID >= 80000 &&
- ($token[0] === T_NAME_QUALIFIED || $token[0] === T_NAME_FULLY_QUALIFIED)
- ) {
- $class .= $token[1];
-
- $classSplit = explode('\\', $token[1]);
- $alias = $classSplit[count($classSplit) - 1];
- } elseif ($token[0] === T_NS_SEPARATOR) {
- $class .= '\\';
- $alias = '';
- } elseif ($token[0] === T_AS) {
- $explicitAlias = true;
- $alias = '';
- } elseif ($token === ',') {
- $statements[strtolower($alias)] = $groupRoot . $class;
- $class = '';
- $alias = '';
- $explicitAlias = false;
- } elseif ($token === ';') {
- $statements[strtolower($alias)] = $groupRoot . $class;
- break;
- } elseif ($token === '{') {
- $groupRoot = $class;
- $class = '';
- } elseif ($token === '}') {
- continue;
- } else {
- break;
- }
- }
-
- return $statements;
- }
-
- /**
- * Gets all use statements.
- *
- * @param string $namespaceName The namespace name of the reflected class.
- *
- * @return array<string, string> A list with all found use statements.
- */
- public function parseUseStatements($namespaceName)
- {
- $statements = [];
- while (($token = $this->next())) {
- if ($token[0] === T_USE) {
- $statements = array_merge($statements, $this->parseUseStatement());
- continue;
- }
-
- if ($token[0] !== T_NAMESPACE || $this->parseNamespace() !== $namespaceName) {
- continue;
- }
-
- // Get fresh array for new namespace. This is to prevent the parser to collect the use statements
- // for a previous namespace with the same name. This is the case if a namespace is defined twice
- // or if a namespace with the same name is commented out.
- $statements = [];
- }
-
- return $statements;
- }
-
- /**
- * Gets the namespace.
- *
- * @return string The found namespace.
- */
- public function parseNamespace()
- {
- $name = '';
- while (
- ($token = $this->next()) && ($token[0] === T_STRING || $token[0] === T_NS_SEPARATOR || (
- PHP_VERSION_ID >= 80000 &&
- ($token[0] === T_NAME_QUALIFIED || $token[0] === T_NAME_FULLY_QUALIFIED)
- ))
- ) {
- $name .= $token[1];
- }
-
- return $name;
- }
-
- /**
- * Gets the class name.
- *
- * @return string The found class name.
- */
- public function parseClass()
- {
- // Namespaces and class names are tokenized the same: T_STRINGs
- // separated by T_NS_SEPARATOR so we can use one function to provide
- // both.
- return $this->parseNamespace();
- }
-}