I'm not sure if I'm misunderstanding, but if you're saying that every reference 
to $this in the body of an extension method will be analysed by the compiler 
against the class definition, that would be extremely surprising to PHP users.

As far as I know, *all* method and property despatch in PHP is dynamic, whether 
it's on $this or any other object reference. In other words, only when you 
actually *run* code like $this->whatever() does PHP even try to look for the 
method definition.

I’m trying to speak vaguely to keep messages brief because I’m generally typing 
from my phone. In doing so, I’m adding inaccurate edge cases which you’re 
astutely noticing, but they aren’t the details I was focused on. For full 
details, please read the draft RFC I posted as a Gist. 
https://gist.github.com/hollyschilling/f590f3a1e488732eea5b0d8014702276

Dispatched inside an extension method is exactly the same as anywhere else 
besides that `$this` only has the public surface accessible. If a user calls a 
method name that doesn’t exist, it does the same as usual. That hasn’t changed.

Reply via email to