4d7004e955
In Zend 5.3 they decided that closures should inherit the ##$this## from the containing scope. This brings us close to paraity with them. The remaining thing is to make
function() use ($this) {}
fatal after we purge it from WWW.
30 linhas
418 B
PHP
30 linhas
418 B
PHP
<?php
|
|
|
|
trait Too {
|
|
function bar() {
|
|
$a = function () {
|
|
var_dump(__CLASS__);
|
|
};
|
|
$a();
|
|
$a = function () {
|
|
var_dump(get_class());
|
|
};
|
|
$a();
|
|
if (isset($this)) {
|
|
$a = function () {
|
|
var_dump(get_class($this));
|
|
};
|
|
$a();
|
|
}
|
|
}
|
|
}
|
|
class Foo { use Too; }
|
|
|
|
$f = new Foo;
|
|
echo "Between\n";
|
|
$f->bar();
|
|
echo "Between\n";
|
|
$f::bar();
|
|
echo "Between\n";
|
|
Foo::bar();
|