Oh my god, PHP.
Wednesday, October 29th, 2008For reasons I don’t understand, this does not work (ReflectionException ‘Class Foo does not have a property named prop’):
class Foo
{
protected static $prop = ‘My value’;
}
$ref = new ReflectionClass(’Foo’);
$prop = $ref->getStaticPropertyValue(’prop’);
However, this does:
$ref = new ReflectionClass(’Foo’);
$props = $ref->getStaticProperties();
$prop = $props['prop'];
This does not work; PHP cannot dereference array return values:
$props = $ref->getStaticProperties()['prop'];
This does [...]
