8000 [PropertyAccess] fix error msg when accessing typed but uninitializer… · symfony/symfony@86608d6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 86608d6

Browse files
[PropertyAccess] fix error msg when accessing typed but uninitializer public properties
1 parent 1d7f774 commit 86608d6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Component/PropertyAccess/PropertyAccessor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ private function readProperty(array 68A7 $zval, string $property, bool $ignoreInvalid
470470
throw $e;
471471
}
472472
} elseif (PropertyReadInfo::TYPE_PROPERTY === $type) {
473-
if (!method_exists($object, '__get') && !\array_key_exists($name, (array) $object)) {
473+
if (!method_exists($object, '__get') && !\array_key_exists($name, (array) $object) && !(new \ReflectionProperty($class, $name))->hasType()) {
474474
throw new UninitializedPropertyException(sprintf('The property "%s::$%s" is not initialized.', $class, $name));
475475
}
476476

0 commit comments

Comments
 (0)
0