diff --git a/docs/en/index.rst b/docs/en/index.rst index fd001f48e..95476c313 100644 --- a/docs/en/index.rst +++ b/docs/en/index.rst @@ -94,7 +94,7 @@ IDE Support Some IDEs already provide support for annotations: -- Eclipse via the `Symfony2 Plugin `_ +- Eclipse via the `Symfony2 Plugin `_ - PhpStorm via the `PHP Annotations Plugin `_ or the `Symfony Plugin `_ .. _Read more about handling annotations.: annotations diff --git a/lib/Doctrine/Common/Annotations/ImplicitlyIgnoredAnnotationNames.php b/lib/Doctrine/Common/Annotations/ImplicitlyIgnoredAnnotationNames.php index 52b929d34..2efeb1d22 100644 --- a/lib/Doctrine/Common/Annotations/ImplicitlyIgnoredAnnotationNames.php +++ b/lib/Doctrine/Common/Annotations/ImplicitlyIgnoredAnnotationNames.php @@ -12,12 +12,13 @@ final class ImplicitlyIgnoredAnnotationNames { private const Reserved = [ - 'Annotation' => true, - 'Attribute' => true, - 'Attributes' => true, + 'Annotation' => true, + 'Attribute' => true, + 'Attributes' => true, /* Can we enable this? 'Enum' => true, */ - 'Required' => true, - 'Target' => true, + 'Required' => true, + 'Target' => true, + 'NamedArgumentConstructor' => true, ]; private const WidelyUsedNonStandard = [ @@ -138,16 +139,21 @@ final class ImplicitlyIgnoredAnnotationNames private const SlevomatCodingStandard = ['phpcsSuppress' => true]; - private const PhpStan = [ + private const Phan = ['suppress' => true]; + + private const Rector = ['noRector' => true]; + + private const StaticAnalysis = [ + // PHPStan, Psalm 'extends' => true, 'implements' => true, 'template' => true, 'use' => true, - ]; - private const Phan = ['suppress' => true]; - - private const Rector = ['noRector' => true]; + // Psalm + 'pure' => true, + 'immutable' => true, + ]; public const LIST = self::Reserved + self::WidelyUsedNonStandard @@ -161,9 +167,9 @@ final class ImplicitlyIgnoredAnnotationNames + self::Symfony + self::SlevomatCodingStandard + self::PhpCodeSniffer - + self::PhpStan + self::Phan - + self::Rector; + + self::Rector + + self::StaticAnalysis; private function __construct() { diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 00e87be13..038d03b00 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -51,6 +51,7 @@ */tests/Doctrine/Tests/Common/Annotations/Fixtures/* + */tests/Doctrine/Tests/Common/Annotations/AbstractReaderTest.php */tests/Doctrine/Tests/Common/Annotations/Fixtures/* diff --git a/tests/Doctrine/Tests/Common/Annotations/AbstractReaderTest.php b/tests/Doctrine/Tests/Common/Annotations/AbstractReaderTest.php index 1ad529e7c..f416023e8 100644 --- a/tests/Doctrine/Tests/Common/Annotations/AbstractReaderTest.php +++ b/tests/Doctrine/Tests/Common/Annotations/AbstractReaderTest.php @@ -409,9 +409,9 @@ public function testIgnoresAnnotationsNotPrefixedWithWhitespace(): void $annotation = $reader->getClassAnnotation( new ReflectionClass(new TestIgnoresNonAnnotationsClass()), - Name::class + NameBar::class ); - self::assertInstanceOf(Name::class, $annotation); + self::assertInstanceOf(NameBar::class, $annotation); } private static $testResetsPhpParserAfterUseRun = false; @@ -594,7 +594,8 @@ class TestParseAnnotationClass } /** - * @Name + * @NameBar + * @author Johannes M. Schmitt */ class TestIgnoresNonAnnotationsClass { @@ -666,6 +667,10 @@ class DummyClass2 public $id; } +/** @Annotation */ +class NameBar extends Annotation +{ +} /** @Annotation */ class DummyId extends Annotation {