21 private readonly
bool $allowZero =
false,
22 private readonly
bool $allowEmptyString =
false,
32 $properties = $this->getProperties($object);
34 if (empty($properties))
43 $values = $this->getValues($object, ...$properties);
51 private function getProperties(
object $object):
array
53 $reflection =
new ReflectionClass($object);
56 $reflection->getProperties(),
57 fn (ReflectionProperty $property):
bool =>
58 in_array($property->getName(), $this->fields,
true)
62 private function getValues(
object $object, ReflectionProperty ...$properties):
array
65 foreach ($properties as $property)
67 if ($property->isInitialized($object))
69 $values[] = $property->getValue($object);
__construct(private readonly array $fields, private readonly bool $allowZero=false, private readonly bool $allowEmptyString=false, protected string|LocalizableMessageInterface|null $errorMessage=null,)
replaceWithCustomError(ValidationResult $result, ?ValidatorInterface $validator=null)