Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/Doctrine/Annotations/AnnotationReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ public function __construct(DocParser $parser = null)

$this->preParser->setImports(self::$globalImports);
$this->preParser->setIgnoreNotImportedAnnotations(true);
$this->preParser->setIgnoredAnnotationNames(self::$globalIgnoredNames);

$this->phpParser = new PhpParser;
}
Expand Down
22 changes: 22 additions & 0 deletions tests/Doctrine/Tests/Annotations/AbstractReaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,28 @@ public function testInvalidAnnotationButIgnored()
self::assertEmpty($reader->getPropertyAnnotations($class->getProperty('foo')));
}

public function testGloballyIgnoredAnnotationNotIgnored() : void
{
$reader = $this->getReader();
$class = new \ReflectionClass(Fixtures\ClassDDC1660::class);

$testLoader = static function (string $className) : bool {
if ($className === 'since') {
throw new \InvalidArgumentException('Globally ignored annotation names should never be passed to an autoloader.');
}

return false;
};

spl_autoload_register($testLoader, true, true);

try {
self::assertEmpty($reader->getClassAnnotations($class));
} finally {
spl_autoload_unregister($testLoader);
}
}

public function testAnnotationEnumeratorException()
{
$reader = $this->getReader();
Expand Down