Skip to content

Commit 32d3d27

Browse files
committed
fix: TypeError on PHP8
TypeError: ReflectionProperty::getValue(): Argument #1 ($object) must be of type ?object, string given
1 parent 6bb309c commit 32d3d27

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/ReflectionHelper.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ public static function getPrivateProperty($obj, string $property)
8080
{
8181
$refProperty = self::getAccessibleRefProperty($obj, $property);
8282

83-
return $refProperty->getValue($obj);
83+
if (is_object($obj)) {
84+
return $refProperty->getValue($obj);
85+
}
86+
87+
return $refProperty->getValue();
8488
}
8589
}

0 commit comments

Comments
 (0)