TypePHP 编译器
https://swoole.com/aot/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
535 B
36 lines
535 B
--TEST--
|
|
Trait class constants remain bound to the composing class when inherited
|
|
--FILE--
|
|
<?php
|
|
trait ClassIdentityTrait
|
|
{
|
|
public function magicClass(): string
|
|
{
|
|
return __CLASS__;
|
|
}
|
|
|
|
public function selfClass(): string
|
|
{
|
|
return self::class;
|
|
}
|
|
}
|
|
|
|
class Base
|
|
{
|
|
use ClassIdentityTrait;
|
|
}
|
|
|
|
class Child extends Base
|
|
{
|
|
}
|
|
|
|
function main(): void
|
|
{
|
|
$object = new Child();
|
|
var_dump($object->magicClass());
|
|
var_dump($object->selfClass());
|
|
}
|
|
?>
|
|
--EXPECT--
|
|
string(4) "Base"
|
|
string(4) "Base"
|
|
|