<?php
namespace foo {
trait A { function B() { var_dump(self::class); } }
}
namespace {
class B { use \foo\A; }
class C { use \foo\A; }
class D extends C {}
function main() {
(new B)->B();
(new C)->B();
(new D)->B();
}
}
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; B has a deprecated constructor in /in/vH4PJ on line 8