Stanislav Malyshev wrote:
>>>> in that situation A::find(); would not be able to know it was being
>>>> called by B::find() because parent:: is considered an explicit class
>>>> name reference.
>>> It will be, just not by means of parent::.
>> I am missing something....then by what means?
>
> By means of using get_called_class() and then using this information
> to call needed method of needed class.
There is still a disconnect somewhere.
<?php

class A
{
    static public function test()
    {
       echo get_called_class();
    }
}

class B extends A
{
    static public function test()
    {
       parent::test();
    }
}


B::test();

?>

This will echo 'A'. So like I said you have no way here of telling that
B:: was used.

Now if you are talking about something like:

<?php

class A
{
    static public function test($called_class)
    {
       echo $called_class;
    }
}

class B
{
    static public function test()
    {
       parent::test(get_class());
    }
}

?>

Then there are two problems (sort of). First problem being, then why
bother with lsb, you can do this already (which more so a 'wth' as
opposed to a problem.) The second and much more prevelent problem is
that iirc you cannot do this kind of loose inheritance with statics in
php 6 without getting at least a strict error thrown (Please correct me
if I am wrong, I don't have the latest php6 code at the moment.)

?>

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to