On Fri, Apr 29, 2016 at 1:12 PM, Nikita Popov <nikita....@gmail.com> wrote:
> Hi internals! > > I'd like to submit a small RFC for your consideration, which ensures > something that really ought to be a given already: If you use $this in an > instance method, you should actually get a $this (and not NULL). > > https://wiki.php.net/rfc/forbid_null_this_in_methods > > As this is targeting PHP 7.1, the RFC is careful to retain compatibility > with certain legacy PHP 4 code patterns. > What is the performance cost of inspecting the method for $this, and is that inspection impervious to tricks that shield $this? Example: A::method(); class A { public function method() { $foo = function () { $this->something(); } } } Does that throw an \Error? Would it throw an \Error if $foo() were called?