Skip to content

Commit f840e4a

Browse files
[PropertyAccess] fix error msg when accessing typed but uninitializer public properties
1 parent bfce1c0 commit f840e4a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

PropertyAccessor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ private function readProperty(array $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)