Hi Stas,

Note that called_scope is passed only to static methods of __parent__
class. I cannot imagine the use-case with intersecting LSBs in the same
class hierarchy. Could you please write the example.

Thanks. Dmitry.

Stanislav Malyshev wrote:
> Hi!
> 
>> Each call to static method of parent class (it doesn't mater if it was
>> done using parent:: or something else) assumes forwarding of called
>> context.
> 
> That would make it impossible to do non-forwarding call. Which means you
> can't use something like ActiveRecord pattern (which uses LSB) inside
> the context of another method that uses LSB too. I.e. if you got the
> called_scope set once, you are stuck with it forever until the topmost
> call ends, and you can not make another (new) LSB call inside that method.
> I don't think it is a good idea. It would lead to massive WTFs when you
> have code that perfectly working in unit tests (when you call it
> independently without called_scope pre-set) but breaks as soon as you
> call it with called_scope set (since all static calls like Foo::bar()
> would instantly start forwarding pre-set called_scope instead of
> creating a new one).
> If this is the way it would work, I'd recommend never using this feature
> - you just can't know what your "Foo::" would produce anymore, since the
> start of the call chain can be anywhere and there's no method to ensure
> you get the actual class that you used in the call. Which as far as I
> remember was the whole point behind LSB, but somehow it is lost now.

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

Reply via email to