Skip to content

Commit 248840f

Browse files
committed
Test if PropertyAccess component is available
1 parent 535c874 commit 248840f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Symfony/Component/Validator/Constraints/UniqueValidator.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
1616
use Symfony\Component\Validator\Constraint;
1717
use Symfony\Component\Validator\ConstraintValidator;
18+
use Symfony\Component\Validator\Exception\LogicException;
1819
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
1920
use Symfony\Component\Validator\Exception\UnexpectedValueException;
2021

@@ -103,6 +104,10 @@ private function reduceElementKeys(array $fields, array|object $element): array
103104
private function getPropertyAccessor(): PropertyAccessorInterface
104105
{
105106
if (null === $this->propertyAccessor) {
107+
if (!class_exists(PropertyAccess::class)) {
108+
throw new LogicException('Unable to use property path as the Symfony PropertyAccess component is not installed.');
109+
}
110+
106111
$this->propertyAccessor = PropertyAccess::createPropertyAccessor();
107112
}
108113

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy