<?php
namespace Foo;
use Foo\Bar as Baz;
trait getClass {
public static function getClass() {
return __CLASS__;
}
public static function getCalledClass() {
return get_called_class();
}
}
class Bar
{
use GetClass;
}
class Biz extends Bar {}
var_dump(
[Baz::CLASS, Baz::getCalledClass(), Baz::getClass()],
[Biz::CLASS, Biz::getCalledClass(), Biz::getClass()]
);
Parse error: syntax error, unexpected 'CLASS' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /in/9gtqN on line 23
Process exited with code 255.
Output for 5.3.0 - 5.3.29
Parse error: syntax error, unexpected T_STRING in /in/9gtqN on line 6
Process exited with code 255.