Skip to content

Commit

Permalink
fix: Unknown Constraint class when not using symfony/validator (#2276)
Browse files Browse the repository at this point in the history
| Q | A |

|---------------|---------------------------------------------------------------------------------------------------------------------------|
| Bug fix? | yes |
| New feature? | no <!-- please update src/**/CHANGELOG.md files --> |
| Deprecations? | no <!-- please update UPGRADE-*.md and
src/**/CHANGELOG.md files --> |
| Issues | Fix #2275 <!-- prefix each issue number with "Fix #", no need
to create an issue if none exists, explain below instead --> |

#2259 accidentally
removed the `class_exists` check for symfony/validator `Constraint`.
This currently causes applications using this bundle to fail because of
the missing symfony/validator dependency
  • Loading branch information
DjordyKoert committed Apr 20, 2024
1 parent 2d0f12d commit 2af8c5d
Showing 1 changed file with 1 addition and 1 deletion.
Expand Up @@ -213,7 +213,7 @@ private function getAnnotations(Context $parentContext, $reflection, ?array $val
*/
private function locateAnnotations($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) {
yield $attribute->newInstance();
}
Expand Down

0 comments on commit 2af8c5d

Please sign in to comment.