- Output for 5.4.0 - 5.4.30
- Parse error: syntax error, unexpected '}' in /in/nY4Oo on line 10
Process exited with code 255. - Output for 5.3.0 - 5.3.28
- Parse error: syntax error, unexpected T_STRING in /in/nY4Oo on line 3
Process exited with code 255.
<?php
trait ClosureInATrait
{
public static function getClosureInTrait()
{
return function () {
return __CLASS__;
}
}
}
class ClassConstantTest
{
use ClosureInATrait;
public static function getClosureInClass()
{
return function () {
return __CLASS__;
}
}
}
$closureInClass = ClassConstantTest::getClosureInClass();
$closureInTrait = ClassConstantTest::getClosureInTrait();
var_dump($closureInClass(), $closureInTrait());
$closureInClass = Closure::bind($closureInClass, new stdClass());
$closureInTrait = Closure::bind($closureInTrait, new stdClass());
var_dump($closureInClass(), $closureInTrait());