diff --git a/src/Sudo.php b/src/Sudo.php index 0015cbc7..a84f31da 100644 --- a/src/Sudo.php +++ b/src/Sudo.php @@ -95,7 +95,13 @@ public static function fetchStaticProperty($class, string $property) public static function assignStaticProperty($class, string $property, $value) { $prop = self::getProperty(new \ReflectionClass($class), $property); - $prop->setValue($value); + $refl = $prop->getDeclaringClass(); + + if (\method_exists($refl, 'setStaticPropertyValue')) { + $refl->setStaticPropertyValue($property, $value); + } else { + $prop->setValue($value); + } return $value; }