From b579dbe3dcde00bad1e2439ad8ccf3490344c042 Mon Sep 17 00:00:00 2001 From: Rishiraj Purohit Date: Sun, 20 Sep 2020 12:53:27 +0200 Subject: [PATCH 1/2] remove internal tag to avoid deprecation warnings --- RouteDescriber/RouteDescriberTrait.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/RouteDescriber/RouteDescriberTrait.php b/RouteDescriber/RouteDescriberTrait.php index 7c62c85..9ab6f21 100644 --- a/RouteDescriber/RouteDescriberTrait.php +++ b/RouteDescriber/RouteDescriberTrait.php @@ -15,9 +15,6 @@ use EXSyst\Component\Swagger\Operation; use EXSyst\Component\Swagger\Swagger; use Symfony\Component\Routing\Route; -/** - * @internal - */ trait RouteDescriberTrait { /** From 6faec063214234993ca3d10a2f1b0e6d613c576a Mon Sep 17 00:00:00 2001 From: Guilhem Niot Date: Sun, 20 Sep 2020 20:38:26 +0200 Subject: [PATCH 2/2] Fix the tests (#1720) * Fix the tests * Add a comment * fix the tests * cs --- .../Annotations/SymfonyConstraintAnnotationReader.php | 3 ++- .../Annotations/SymfonyConstraintAnnotationReaderTest.php | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ModelDescriber/Annotations/SymfonyConstraintAnnotationReader.php b/ModelDescriber/Annotations/SymfonyConstraintAnnotationReader.php index 311bebe..a6d3daa 100644 --- a/ModelDescriber/Annotations/SymfonyConstraintAnnotationReader.php +++ b/ModelDescriber/Annotations/SymfonyConstraintAnnotationReader.php @@ -48,7 +48,8 @@ class SymfonyConstraintAnnotationReader foreach ($annotations as $annotation) { if ($annotation instanceof Assert\NotBlank || $annotation instanceof Assert\NotNull) { - if ($annotation instanceof Assert\NotBlank && $annotation->allowNull) { + // To support symfony/validator < 4.3 + if ($annotation instanceof Assert\NotBlank && \method_exists($annotation, 'allowNull') && $annotation->allowNull) { // The field is optional continue; } diff --git a/Tests/ModelDescriber/Annotations/SymfonyConstraintAnnotationReaderTest.php b/Tests/ModelDescriber/Annotations/SymfonyConstraintAnnotationReaderTest.php index c781db1..36c5b78 100644 --- a/Tests/ModelDescriber/Annotations/SymfonyConstraintAnnotationReaderTest.php +++ b/Tests/ModelDescriber/Annotations/SymfonyConstraintAnnotationReaderTest.php @@ -49,6 +49,10 @@ class SymfonyConstraintAnnotationReaderTest extends TestCase public function testOptionalProperty() { + if (!\method_exists(Assert\NotBlank::class, 'allowNull')) { + $this->markTestSkipped('NotBlank::allowNull was added in symfony/validator 4.3.'); + } + $entity = new class() { /** * @Assert\NotBlank(allowNull = true)