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.
31 linhas
378 B
PHP
31 linhas
378 B
PHP
<?php
|
|
|
|
trait A {
|
|
public function b() {
|
|
return function() {
|
|
return array(
|
|
__CLASS__,
|
|
get_class($this)
|
|
);
|
|
};
|
|
}
|
|
}
|
|
|
|
class C {
|
|
use A;
|
|
public function d() {
|
|
return function() {
|
|
return array(
|
|
__CLASS__,
|
|
get_class($this)
|
|
);
|
|
};
|
|
}
|
|
}
|
|
|
|
$c = new C;
|
|
$b = $c->b();
|
|
var_dump($b());
|
|
$d = $c->d();
|
|
var_dump($d());
|