From fa873ef6db84cf57ca2f635b6691eb94e4a84982 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Jusi=C4=99ga?= Date: Mon, 14 Jun 2021 21:58:16 +0200 Subject: [PATCH 1/2] Add possible missing imports --- src/Symfony/Component/Routing/Annotation/Route.php | 2 ++ src/Symfony/Component/Serializer/Annotation/Context.php | 1 + .../Component/Serializer/Annotation/DiscriminatorMap.php | 1 + src/Symfony/Component/Serializer/Annotation/Groups.php | 1 + src/Symfony/Component/Serializer/Annotation/MaxDepth.php | 1 + src/Symfony/Component/Serializer/Annotation/SerializedName.php | 1 + 6 files changed, 7 insertions(+) diff --git a/src/Symfony/Component/Routing/Annotation/Route.php b/src/Symfony/Component/Routing/Annotation/Route.php index b3089c919dbdc..8480b7bd6b1de 100644 --- a/src/Symfony/Component/Routing/Annotation/Route.php +++ b/src/Symfony/Component/Routing/Annotation/Route.php @@ -11,6 +11,8 @@ namespace Symfony\Component\Routing\Annotation; +use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor; + /** * Annotation class for @Route(). * diff --git a/src/Symfony/Component/Serializer/Annotation/Context.php b/src/Symfony/Component/Serializer/Annotation/Context.php index 3d6464790c72e..d4f735325d47c 100644 --- a/src/Symfony/Component/Serializer/Annotation/Context.php +++ b/src/Symfony/Component/Serializer/Annotation/Context.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Serializer\Annotation; +use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor; use Symfony\Component\Serializer\Exception\InvalidArgumentException; /** diff --git a/src/Symfony/Component/Serializer/Annotation/DiscriminatorMap.php b/src/Symfony/Component/Serializer/Annotation/DiscriminatorMap.php index d01287bfd398a..414b4de99f080 100644 --- a/src/Symfony/Component/Serializer/Annotation/DiscriminatorMap.php +++ b/src/Symfony/Component/Serializer/Annotation/DiscriminatorMap.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Serializer\Annotation; +use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor; use Symfony\Component\Serializer\Exception\InvalidArgumentException; /** diff --git a/src/Symfony/Component/Serializer/Annotation/Groups.php b/src/Symfony/Component/Serializer/Annotation/Groups.php index 0a251f786cc8c..9538c894597ca 100644 --- a/src/Symfony/Component/Serializer/Annotation/Groups.php +++ b/src/Symfony/Component/Serializer/Annotation/Groups.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Serializer\Annotation; +use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor; use Symfony\Component\Serializer\Exception\InvalidArgumentException; /** diff --git a/src/Symfony/Component/Serializer/Annotation/MaxDepth.php b/src/Symfony/Component/Serializer/Annotation/MaxDepth.php index e0cc41ebd119e..87b01493bf4d2 100644 --- a/src/Symfony/Component/Serializer/Annotation/MaxDepth.php +++ b/src/Symfony/Component/Serializer/Annotation/MaxDepth.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Serializer\Annotation; +use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor; use Symfony\Component\Serializer\Exception\InvalidArgumentException; /** diff --git a/src/Symfony/Component/Serializer/Annotation/SerializedName.php b/src/Symfony/Component/Serializer/Annotation/SerializedName.php index 874d955f10097..a6a177406421b 100644 --- a/src/Symfony/Component/Serializer/Annotation/SerializedName.php +++ b/src/Symfony/Component/Serializer/Annotation/SerializedName.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Serializer\Annotation; +use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor; use Symfony\Component\Serializer\Exception\InvalidArgumentException; /** From c2c0979af8f10ded8a81f8c2b1c5bdda387c74e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Jusi=C4=99ga?= Date: Tue, 15 Jun 2021 23:17:34 +0200 Subject: [PATCH 2/2] Add test case for Route Annotation --- .../Component/Routing/Tests/Annotation/RouteTest.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Symfony/Component/Routing/Tests/Annotation/RouteTest.php b/src/Symfony/Component/Routing/Tests/Annotation/RouteTest.php index e249aa5da8903..c1f8750a416ae 100644 --- a/src/Symfony/Component/Routing/Tests/Annotation/RouteTest.php +++ b/src/Symfony/Component/Routing/Tests/Annotation/RouteTest.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Routing\Tests\Annotation; +use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor; use Doctrine\Common\Annotations\AnnotationReader; use PHPUnit\Framework\TestCase; use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait; @@ -89,6 +90,13 @@ public function testLoadFromDoctrineAnnotation(string $methodName, string $gette $this->assertEquals($route->$getter(), $expectedReturn); } + public function testLoadFromDoctrineAnnotationInClassDocblock() + { + $annotations = (new AnnotationReader())->getClassAnnotations(new \ReflectionClass(Route::class)); + $this->assertNotEmpty($annotations); + $this->assertInstanceOf(NamedArgumentConstructor::class, $annotations[1]); + } + public function getValidParameters(): iterable { return [