mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-02 23:59:26 +03:00
Merge pull request #1833 from NicolasCharpentier/NicolasCharpentier-patch-symfony-validator-optional-dependency
Add a check for Constraint class existing before using it
This commit is contained in:
commit
b2c5b619a6
@ -166,7 +166,7 @@ class SymfonyConstraintAnnotationReader
|
|||||||
*/
|
*/
|
||||||
private function getAnnotations($reflection): \Traversable
|
private function getAnnotations($reflection): \Traversable
|
||||||
{
|
{
|
||||||
if (\PHP_VERSION_ID >= 80000) {
|
if (\PHP_VERSION_ID >= 80000 && class_exists(Constraint::class)) {
|
||||||
foreach ($reflection->getAttributes(Constraint::class, \ReflectionAttribute::IS_INSTANCEOF) as $attribute) {
|
foreach ($reflection->getAttributes(Constraint::class, \ReflectionAttribute::IS_INSTANCEOF) as $attribute) {
|
||||||
yield $attribute->newInstance();
|
yield $attribute->newInstance();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user