X-Git-Url: https://yaffs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=vendor%2Fdoctrine%2Fannotations%2Flib%2FDoctrine%2FCommon%2FAnnotations%2FAnnotationReader.php;h=0c060496515e04881ef38788102dda5d7c964a42;hb=refs%2Fheads%2Ft2;hp=4ebd1fb4a00c50d2493f89733b3a1590fabc1e11;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationReader.php b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationReader.php index 4ebd1fb4a..0c0604965 100644 --- a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationReader.php +++ b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationReader.php @@ -100,8 +100,19 @@ class AnnotationReader implements Reader 'package_version' => true, // PlantUML 'startuml' => true, 'enduml' => true, + // Symfony 3.3 Cache Adapter + 'experimental' => true ); + /** + * A list with annotations that are not causing exceptions when not resolved to an annotation class. + * + * The names are case sensitive. + * + * @var array + */ + private static $globalIgnoredNamespaces = array(); + /** * Add a new annotation to the globally ignored annotation names with regard to exception handling. * @@ -112,6 +123,16 @@ class AnnotationReader implements Reader self::$globalIgnoredNames[$name] = true; } + /** + * Add a new annotation to the globally ignored annotation namespaces with regard to exception handling. + * + * @param string $namespace + */ + static public function addGlobalIgnoredNamespace($namespace) + { + self::$globalIgnoredNamespaces[$namespace] = true; + } + /** * Annotations parser. * @@ -151,8 +172,12 @@ class AnnotationReader implements Reader * Constructor. * * Initializes a new AnnotationReader. + * + * @param DocParser $parser + * + * @throws AnnotationException */ - public function __construct() + 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(); @@ -174,7 +199,8 @@ class AnnotationReader implements Reader AnnotationRegistry::registerFile(__DIR__ . '/Annotation/IgnoreAnnotation.php'); - $this->parser = new DocParser; + $this->parser = $parser ?: new DocParser(); + $this->preParser = new DocParser; $this->preParser->setImports(self::$globalImports); @@ -191,6 +217,7 @@ class AnnotationReader implements Reader $this->parser->setTarget(Target::TARGET_CLASS); $this->parser->setImports($this->getClassImports($class)); $this->parser->setIgnoredAnnotationNames($this->getIgnoredAnnotationNames($class)); + $this->parser->setIgnoredAnnotationNamespaces(self::$globalIgnoredNamespaces); return $this->parser->parse($class->getDocComment(), 'class ' . $class->getName()); } @@ -222,6 +249,7 @@ class AnnotationReader implements Reader $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); } @@ -253,6 +281,7 @@ class AnnotationReader implements Reader $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); } @@ -282,7 +311,8 @@ class AnnotationReader implements Reader */ private function getIgnoredAnnotationNames(ReflectionClass $class) { - if (isset($this->ignoredAnnotationNames[$name = $class->getName()])) { + $name = $class->getName(); + if (isset($this->ignoredAnnotationNames[$name])) { return $this->ignoredAnnotationNames[$name]; } @@ -300,7 +330,8 @@ class AnnotationReader implements Reader */ private function getClassImports(ReflectionClass $class) { - if (isset($this->imports[$name = $class->getName()])) { + $name = $class->getName(); + if (isset($this->imports[$name])) { return $this->imports[$name]; }