<?php
namespace NAME_SPACE;
trait Bar
{
public static function qux()
{
var_dump(self::class, static::class);
return new \ReflectionFunction(function () {});
}
}
class Foo
{
use Bar;
}
var_dump(Foo::qux()->getName());
Bar::qux();
string(14) "NAME_SPACE\Foo"
string(14) "NAME_SPACE\Foo"
string(20) "NAME_SPACE\{closure}"
Deprecated: Calling static trait method NAME_SPACE\Bar::qux is deprecated, it should only be called on a class using the trait in /in/YPFJM 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/YPFJM 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/YPFJM on line 5
Process exited with code 255.