From 21e78f610022c9cc28edf1f8d2db8dbbb6af2ffa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81ngel=20Guzm=C3=A1n=20Maeso?= Date: Mon, 21 Jun 2021 00:11:55 +0200 Subject: [PATCH 1/5] Update Eclipse Symfony 2 Plugin The url dubture.com is down (unknown reason). Pointing to github repository --- docs/en/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From f0a4f8ca483bb2d594611b407f42a3a8488e777c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Fri, 23 Apr 2021 20:52:39 +0200 Subject: [PATCH 2/5] Restore annotation that should be ignored This class is used in a test that checks that annotations that are supposed to be ignored are indeed ignored. --- phpcs.xml.dist | 1 + tests/Doctrine/Tests/Common/Annotations/AbstractReaderTest.php | 1 + 2 files changed, 2 insertions(+) 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..19da3a365 100644 --- a/tests/Doctrine/Tests/Common/Annotations/AbstractReaderTest.php +++ b/tests/Doctrine/Tests/Common/Annotations/AbstractReaderTest.php @@ -595,6 +595,7 @@ class TestParseAnnotationClass /** * @Name + * @author Johannes M. Schmitt */ class TestIgnoresNonAnnotationsClass { From 231a78f583be0845da4cd40960c837ed4e242276 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Fri, 23 Apr 2021 21:11:24 +0200 Subject: [PATCH 3/5] Make tests independent from each other AbstractReaderTest relied on an annotation defined in DocParserTest. As a consequence, running extending tests by themselves failed. --- .../Tests/Common/Annotations/AbstractReaderTest.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/Doctrine/Tests/Common/Annotations/AbstractReaderTest.php b/tests/Doctrine/Tests/Common/Annotations/AbstractReaderTest.php index 19da3a365..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,7 @@ class TestParseAnnotationClass } /** - * @Name + * @NameBar * @author Johannes M. Schmitt */ class TestIgnoresNonAnnotationsClass @@ -667,6 +667,10 @@ class DummyClass2 public $id; } +/** @Annotation */ +class NameBar extends Annotation +{ +} /** @Annotation */ class DummyId extends Annotation { From 70fe3baf1ae48595724f21989bfc8a06ffe479c2 Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Sat, 17 Jul 2021 01:43:25 +0200 Subject: [PATCH 4/5] Add NamedArgumentConstructor to reserved annotations --- .../Annotations/ImplicitlyIgnoredAnnotationNames.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/Doctrine/Common/Annotations/ImplicitlyIgnoredAnnotationNames.php b/lib/Doctrine/Common/Annotations/ImplicitlyIgnoredAnnotationNames.php index 52b929d34..0c8accf13 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 = [ From a28ac49412b945ceb565bb9c273dd7122a2fba03 Mon Sep 17 00:00:00 2001 From: Saif Eddin Gmati <29315886+azjezz@users.noreply.github.com> Date: Wed, 28 Jul 2021 14:23:48 +0100 Subject: [PATCH 5/5] Add psalm annotations to ignored annotation names Signed-off-by: azjezz --- .../ImplicitlyIgnoredAnnotationNames.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/lib/Doctrine/Common/Annotations/ImplicitlyIgnoredAnnotationNames.php b/lib/Doctrine/Common/Annotations/ImplicitlyIgnoredAnnotationNames.php index 0c8accf13..2efeb1d22 100644 --- a/lib/Doctrine/Common/Annotations/ImplicitlyIgnoredAnnotationNames.php +++ b/lib/Doctrine/Common/Annotations/ImplicitlyIgnoredAnnotationNames.php @@ -139,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 @@ -162,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() {