mirror of
https://github.com/Respect/Validation.git
synced 2024-06-02 05:42:16 +02:00
Also read private properties of parent classes
This commit is contained in:
parent
9bad066765
commit
8a09799e7e
|
@ -29,8 +29,6 @@ use Respect\Validation\Exceptions\ValidationException;
|
|||
* Factory of objects.
|
||||
*
|
||||
* @author Henrique Moody <henriquemoody@gmail.com>
|
||||
*
|
||||
* @since 0.8.0
|
||||
*/
|
||||
final class Factory
|
||||
{
|
||||
|
@ -228,11 +226,11 @@ final class Factory
|
|||
|
||||
/**
|
||||
* @param Validatable $validatable
|
||||
* @param ReflectionObject $reflection
|
||||
* @param ReflectionClass $reflection
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function extractPropertiesValues(Validatable $validatable, ReflectionObject $reflection): array
|
||||
private function extractPropertiesValues(Validatable $validatable, ReflectionClass $reflection): array
|
||||
{
|
||||
$values = [];
|
||||
foreach ($reflection->getProperties() as $property) {
|
||||
|
@ -241,6 +239,10 @@ final class Factory
|
|||
$values[$property->getName()] = $property->getValue($validatable);
|
||||
}
|
||||
|
||||
if (($parentReflection = $reflection->getParentClass())) {
|
||||
return $values + $this->extractPropertiesValues($validatable, $parentReflection);
|
||||
}
|
||||
|
||||
return $values;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue