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.
52 lines
743 B
52 lines
743 B
--TEST--
|
|
Trait parent:: call remains bound to the composing class when inherited
|
|
--FILE--
|
|
<?php
|
|
|
|
trait ParentCallTrait
|
|
{
|
|
public function source(): string
|
|
{
|
|
return parent::source();
|
|
}
|
|
}
|
|
|
|
class RootClass
|
|
{
|
|
public function source(): string
|
|
{
|
|
return 'root';
|
|
}
|
|
}
|
|
|
|
class TraitUser extends RootClass
|
|
{
|
|
use ParentCallTrait;
|
|
}
|
|
|
|
class ChildClass extends TraitUser
|
|
{
|
|
}
|
|
|
|
class OtherRootClass
|
|
{
|
|
public function source(): string
|
|
{
|
|
return 'other';
|
|
}
|
|
}
|
|
|
|
class OtherTraitUser extends OtherRootClass
|
|
{
|
|
use ParentCallTrait;
|
|
}
|
|
|
|
function main(): void
|
|
{
|
|
var_dump((new ChildClass())->source());
|
|
var_dump((new OtherTraitUser())->source());
|
|
}
|
|
?>
|
|
--EXPECT--
|
|
string(4) "root"
|
|
string(5) "other"
|
|
|