Seems that Reflection doesn`t resolve late static bindings - var_dump will show "string 'a' (length=1)".
<?php
class ParentClass { protected static $a = 'a'; static public function init() { return static::$a; } }
class ChildClass extends ParentClass { protected static $a = 'b'; }
$r = new ReflectionClass('ChildClass');
var_dump($r->getMethod('init')->invoke(null));
?>
ReflectionMethod::invoke
(PHP 5)
ReflectionMethod::invoke — Yöntemi çağırır
Açıklama
Yansıtılan yöntemi çağırır.
Uyarı
Bu işlev hala belgelendirilmemiştir; sadece değiştirge listesi mevcuttur.
Değiştirgeler
-
nesne -
Çağrılacak nesne.
-
değiştirgeler -
Aktarılacak değiştirge listesi. call_user_func() işlevindeki gibi yeteri sayıda değiştirge aktarabilirsiniz.
Dönen Değerler
templargrey at wp dot pl
21-Jul-2011 01:12
rojaro at gmail dot com
10-Feb-2011 01:56
Note: If you want to invoke protected or private methods, you'll first have to make them accessible using the setAccessible() method (see http://php.net/reflectionmethod.setaccessible ).
