Re: [PATCH] late binding for parent (and other options) - Was Re: [PHP-DEV] late static binding php6
| From: | David Zülke | Date: | Mon, 26 Nov 2007 13:30:00 +0000 |
| Subject: | Re: [PATCH] late binding for parent (and other options) - Was Re: [PHP-DEV] late static binding php6 | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-33440@lists.php.net to get a copy of this message | ||
Am 26.11.2007 um 10:24 schrieb Alexey Zakhlestin:
On 11/26/07, Mike Lively <m@digitalsandwich.com> wrote:Definitely. However, given the arguments here, I was thinking this: - static always points to the original callee, w/o being "broken" by parent:: - get_called_class() should _not_ behave like shown above. It really was not B that got called, but it was A, trough parent:: - a new get_static_class() method should return "B". (essentially, get_called_class() returns the name of "self", while get_static_class() returns the name of "static"). So: class A { public static function test() {class A { public static function test() {I believe this first patch is the proper way to go. It feels "natural", "intuitive", etc.echo get_called_class()."\n";} } class B extends A { public static function test() {parent::test();} } A::test(); B::test(); will output: A B
echo get_called_class() . get_static_class();} } class B extends A { public static function test() {
parent::test();} } outputs: AAAB - David