<?php
trait t {
public function dump(){
print_r(array(
get_called_class(),
__CLASS__,
__TRAIT__
));
}
};
class foo {
}
class bar extends foo {
use t;
}
t::dump();
foo::dump();
bar::dump();
Deprecated: Calling static trait method t::dump is deprecated, it should only be called on a class using the trait in /in/gEeKf on line 18
Fatal error: Uncaught Error: Non-static method t::dump() cannot be called statically in /in/gEeKf:18
Stack trace:
#0 {main}
thrown in /in/gEeKf on line 18
Process exited with code 255.
Output for 8.0.0 - 8.0.30
Fatal error: Uncaught Error: Non-static method t::dump() cannot be called statically in /in/gEeKf:18
Stack trace:
#0 {main}
thrown in /in/gEeKf on line 18
Process exited with code 255.
Deprecated: Non-static method t::dump() should not be called statically in /in/gEeKf on line 18
Array
(
[0] => t
[1] => t
[2] => t
)
Fatal error: Uncaught Error: Call to undefined method foo::dump() in /in/gEeKf:19
Stack trace:
#0 {main}
thrown in /in/gEeKf on line 19
Process exited with code 255.
Output for 7.3.32 - 7.3.33, 7.4.26
Array
(
[0] => t
[1] => t
[2] => t
)
Fatal error: Uncaught Error: Call to undefined method foo::dump() in /in/gEeKf:19
Stack trace:
#0 {main}
thrown in /in/gEeKf on line 19
Process exited with code 255.
Output for 5.5.0 - 5.5.35, 5.6.0 - 5.6.28
Strict Standards: Non-static method t::dump() should not be called statically in /in/gEeKf on line 18
Array
(
[0] => t
[1] => t
[2] => t
)
Fatal error: Call to undefined method foo::dump() in /in/gEeKf on line 19
Process exited with code 255.
Output for 5.4.0 - 5.4.45
Array
(
[0] => t
[1] => t
[2] => t
)
Fatal error: Call to undefined method foo::dump() in /in/gEeKf on line 19
Process exited with code 255.
Output for 5.2.3 - 5.2.17, 5.3.0 - 5.3.29
Parse error: syntax error, unexpected T_STRING in /in/gEeKf on line 2
Process exited with code 255.