Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix type error in SymfonyConstraintAnnotationReader #2045

Merged
merged 1 commit into from Oct 23, 2022
Merged

Fix type error in SymfonyConstraintAnnotationReader #2045

merged 1 commit into from Oct 23, 2022

Conversation

manowark
Copy link
Contributor

Steps to reproduce:

  • enable use_validation_groups: true in configuration
  • add model property with type array and Assert\Valid constraint on it
  • try to build Api Doc

Got array_intersect(): Argument #2 must be of type array, null given in the ModelDescriber/Annotations/SymfonyConstraintAnnotationReader.php:228

@manowark
Copy link
Contributor Author

manowark commented Oct 19, 2022

Without fix tests failed like the following:

$ ./phpunit -c phpunit.xml.dist
PHPUnit 9.5.25 #StandWithUkraine

Testing
...............................................................  63 / 204 ( 30%)
..................EE........................................... 126 / 204 ( 61%)
............................................................... 189 / 204 ( 92%)
...............                                                 204 / 204 (100%)

Time: 00:09.969, Memory: 34.00 MB

There were 2 errors:

1) Nelmio\ApiDocBundle\Tests\Functional\ValidationGroupsFunctionalTest::testConstraintGroupsAreRespectedWhenDescribingModels
TypeError: array_intersect(): Argument #2 must be of type array, null given

/home/user/projects/NelmioApiDocBundle/ModelDescriber/Annotations/SymfonyConstraintAnnotationReader.php:228
/home/user/projects/NelmioApiDocBundle/ModelDescriber/Annotations/SymfonyConstraintAnnotationReader.php:192
/home/user/projects/NelmioApiDocBundle/ModelDescriber/Annotations/SymfonyConstraintAnnotationReader.php:54
/home/user/projects/NelmioApiDocBundle/ModelDescriber/Annotations/AnnotationsReader.php:67
/home/user/projects/NelmioApiDocBundle/ModelDescriber/ObjectModelDescriber.php:137
/home/user/projects/NelmioApiDocBundle/Model/ModelRegistry.php:96
/home/user/projects/NelmioApiDocBundle/Model/ModelRegistry.php:117
/home/user/projects/NelmioApiDocBundle/ApiDocGenerator.php:117
/home/user/projects/NelmioApiDocBundle/Tests/Functional/WebTestCase.php:29
/home/user/projects/NelmioApiDocBundle/Tests/Functional/WebTestCase.php:42
/home/user/projects/NelmioApiDocBundle/Tests/Functional/ValidationGroupsFunctionalTest.php:49

2) Nelmio\ApiDocBundle\Tests\Functional\ValidationGroupsFunctionalTest::testConstraintDefaultGroupsAreRespectedWhenReadingAnnotations
TypeError: array_intersect(): Argument #2 must be of type array, null given

/home/user/projects/NelmioApiDocBundle/ModelDescriber/Annotations/SymfonyConstraintAnnotationReader.php:228
/home/user/projects/NelmioApiDocBundle/ModelDescriber/Annotations/SymfonyConstraintAnnotationReader.php:192
/home/user/projects/NelmioApiDocBundle/ModelDescriber/Annotations/SymfonyConstraintAnnotationReader.php:54
/home/user/projects/NelmioApiDocBundle/ModelDescriber/Annotations/AnnotationsReader.php:67
/home/user/projects/NelmioApiDocBundle/ModelDescriber/ObjectModelDescriber.php:137
/home/user/projects/NelmioApiDocBundle/Model/ModelRegistry.php:96
/home/user/projects/NelmioApiDocBundle/Model/ModelRegistry.php:117
/home/user/projects/NelmioApiDocBundle/ApiDocGenerator.php:117
/home/user/projects/NelmioApiDocBundle/Tests/Functional/WebTestCase.php:29
/home/user/projects/NelmioApiDocBundle/Tests/Functional/WebTestCase.php:42
/home/user/projects/NelmioApiDocBundle/Tests/Functional/ValidationGroupsFunctionalTest.php:82

@GuilhemN GuilhemN merged commit f331441 into nelmio:master Oct 23, 2022
@GuilhemN
Copy link
Collaborator

Good catch, thank you @manowark!

@manowark manowark deleted the fix-error-in-symfony-constraint-annotation-reader branch October 24, 2022 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants