diff --git a/lib/Doctrine/Common/Annotations/DocParser.php b/lib/Doctrine/Common/Annotations/DocParser.php index b1dcf3b05..e1f5de315 100644 --- a/lib/Doctrine/Common/Annotations/DocParser.php +++ b/lib/Doctrine/Common/Annotations/DocParser.php @@ -752,7 +752,7 @@ private function Annotation() // 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($name)) { + if ($this->isIgnoredAnnotation($originalName) || $this->isIgnoredAnnotation($name)) { return false; } diff --git a/tests/Doctrine/Tests/Common/Annotations/AnnotationReaderTest.php b/tests/Doctrine/Tests/Common/Annotations/AnnotationReaderTest.php index 996d48acc..818c3e60d 100644 --- a/tests/Doctrine/Tests/Common/Annotations/AnnotationReaderTest.php +++ b/tests/Doctrine/Tests/Common/Annotations/AnnotationReaderTest.php @@ -7,6 +7,7 @@ use Doctrine\Common\Annotations\DocParser; use Doctrine\Tests\Common\Annotations\Fixtures\Annotation\SingleUseAnnotation; use Doctrine\Tests\Common\Annotations\Fixtures\ClassWithFullPathUseStatement; +use Doctrine\Tests\Common\Annotations\Fixtures\ClassWithImportedIgnoredAnnotation; use Doctrine\Tests\Common\Annotations\Fixtures\ClassWithPHPCodeSnifferAnnotation; use Doctrine\Tests\Common\Annotations\Fixtures\ClassWithPhpCsSuppressAnnotation; use Doctrine\Tests\Common\Annotations\Fixtures\ClassWithPHPStanGenericsAnnotations; @@ -196,4 +197,12 @@ public function testPHPStanGenericsAnnotationsAreIgnored() $this->expectExceptionMessage('[Semantical Error] The annotation "@Template" in method Doctrine\Tests\Common\Annotations\Fixtures\ClassWithPHPStanGenericsAnnotations::twigTemplateFunctionName() was never imported.'); self::assertEmpty($reader->getMethodAnnotations($ref->getMethod('twigTemplateFunctionName'))); } + + public function testImportedIgnoredAnnotationIsStillIgnored() + { + $reader = $this->getReader(); + $ref = new \ReflectionClass(ClassWithImportedIgnoredAnnotation::class); + + self::assertEmpty($reader->getMethodAnnotations($ref->getMethod('something'))); + } } diff --git a/tests/Doctrine/Tests/Common/Annotations/Fixtures/Annotation/Param.php b/tests/Doctrine/Tests/Common/Annotations/Fixtures/Annotation/Param.php new file mode 100644 index 000000000..a397d9826 --- /dev/null +++ b/tests/Doctrine/Tests/Common/Annotations/Fixtures/Annotation/Param.php @@ -0,0 +1,7 @@ +