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
2 changes: 1 addition & 1 deletion lib/Doctrine/Common/Annotations/DocParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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')));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace Doctrine\Tests\Common\Annotations\Fixtures\Annotation;

class Param
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace Doctrine\Tests\Common\Annotations\Fixtures;

use Doctrine\Tests\Common\Annotations\Fixtures\Annotation\Param;

class ClassWithImportedIgnoredAnnotation
{
/**
* @param string $foo
*/
public function something($foo)
{
}
}