X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=vendor%2Fdoctrine%2Fannotations%2Flib%2FDoctrine%2FCommon%2FAnnotations%2FAnnotationReader.php;fp=vendor%2Fdoctrine%2Fannotations%2Flib%2FDoctrine%2FCommon%2FAnnotations%2FAnnotationReader.php;h=6c579775fd682fb344db60a6f17a7d1ce5c25c24;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hp=4ebd1fb4a00c50d2493f89733b3a1590fabc1e11;hpb=aea91e65e895364e460983b890e295aa5d5540a5;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..6c579775f 100644 --- a/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationReader.php +++ b/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationReader.php @@ -102,6 +102,15 @@ class AnnotationReader implements Reader 'startuml' => true, 'enduml' => 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 +121,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 +170,10 @@ class AnnotationReader implements Reader * Constructor. * * Initializes a new AnnotationReader. + * + * @param DocParser $parser */ - 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 +195,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 +213,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 +245,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 +277,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 +307,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 +326,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]; }