So it seems $this can be used simply if it isn't specified via the "use" keyword.
The following echoes 'bar':
class Foo
{
private $foo = 'bar';
public function bar()
{
return function()
{
echo $this->foo;
};
}
}
$bar = (new Foo)->bar();
$bar();
This was reported in the php-internals mailing list and is apparently overhang from 5.3's lack of support for this functionality:
http://marc.info/?l=php-internals&m=132592886711725
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…