You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
&& preg_match('/Return value (?:of .*::\w+\(\) )?must be of (?:the )?type (\w+), null returned$/', $e->getMessage(), $matches)
403
403
) {
404
-
thrownewAccessException(sprintf('The method "%s::%s()" returned "null", but expected type "%3$s". Did you forget to initialize a property or to make the return type nullable using "?%3$s"?', !str_contains(\get_class($object), "@anonymous\0") ? \get_class($object) : (get_parent_class($object) ?: 'class').'@anonymous', $access[self::ACCESS_NAME], $matches[1]), 0, $e);
404
+
thrownewAccessException(sprintf('The method "%s::%s()" returned "null", but expected type "%3$s". Did you forget to initialize a property or to make the return type nullable using "?%3$s"?', $this->declaringClassHumanized($object), $access[self::ACCESS_NAME], $matches[1]), 0, $e);
if (\PHP_VERSION_ID >= 70400 && preg_match('/^Typed property ('.preg_quote(get_debug_type($object), '/').')::\$(\w+) must not be accessed before initialization$/', $e->getMessage(), $matches)) {
440
-
$r = new \ReflectionProperty($class, $matches[2]);
439
+
if (\PHP_VERSION_ID >= 70400 && preg_match('/^Typed property ([\w\\\@]+)::\$(\w+) must not be accessed before initialization$/', $e->getMessage(), $matches)) {
440
+
$r = new \ReflectionProperty(str_contains($matches[1], '@anonymous') ? $class : $matches[1], $matches[2]);
thrownewAccessException(sprintf('The property "%s::$%s" is not readable because it is typed "%s". You should initialize it or declare a default value instead.', $matches[1], $r->getName(), $type), 0, $e);
443
+
thrownewAccessException(sprintf('The property "%s::$%s" is not readable because it is typed "%s". You should initialize it or declare a default value instead.', $this->declaringClassHumanized($object), $r->getName(), $type), 0, $e);
$this->expectExceptionMessage('The property "Symfony\Component\PropertyAccess\Tests\Fixtures\ExtendedUninitializedProperty::$uninitialized" is not readable because it is typed "string". You should initialize it or declare a default value instead.');
$this->expectExceptionMessage('The property "Symfony\Component\PropertyAccess\Tests\Fixtures\ExtendedUninitializedProperty::$privateUninitialized" is not readable because it is typed "string". You should initialize it or declare a default value instead.');
0 commit comments