<?php
class Base {
public static $prop = 'BASE';
public function getProp() {
return static::$prop;
}
}
class Mock extends Base { }
$obj = new Mock;
$excepted = 'REFLECTED';
$property = new ReflectionProperty('Base', 'prop');
$property->setAccessible(true);
$property->setValue($excepted);
$actual = $obj->getProp();
echo "Schould be `{$excepted}` and is `{$actual}`\n";
Deprecated: Calling ReflectionProperty::setValue() with a single argument is deprecated in /in/dClFS on line 15
Schould be `REFLECTED` and is `REFLECTED`