As of PHP 5.5 you can also use "static::class" to get the name of the called class.
<?php
class Bar {
public static function test() {
var_dump(static::class);
}
}
class Foo extends Bar {
}
Foo::test();
Bar::test();
?>
Output:
string(3) "Foo"
string(3) "Bar"