<?php
namespace NAME_SPACE;
trait Bar
{
public static function qux()
{
var_dump(self::class, static::class);
return new \ReflectionMethod(static::class, __FUNCTION__);
}
}
class Foo
{
use Bar;
}
var_dump(Foo::qux()->getName());
Bar::qux();
string(14) "NAME_SPACE\Foo"
string(14) "NAME_SPACE\Foo"
string(3) "qux"
Deprecated: Calling static trait method NAME_SPACE\Bar::qux is deprecated, it should only be called on a class using the trait in /in/O15jg on line 20
string(14) "NAME_SPACE\Bar"
string(14) "NAME_SPACE\Bar"
Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /in/O15jg on line 9
Process exited with code 255.
Output for 5.3.0 - 5.3.29
Parse error: syntax error, unexpected T_STRING in /in/O15jg on line 5
Process exited with code 255.