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.
24 lines
488 B
24 lines
488 B
<?php
|
|
trait RequiresValue
|
|
{
|
|
abstract public function value(int $value): string;
|
|
}
|
|
|
|
// Aliasing an abstract method creates the requirement under the new name;
|
|
// the class method defined under that name must satisfy it.
|
|
class AliasImplementation
|
|
{
|
|
use RequiresValue { value as renamed; }
|
|
|
|
public function renamed(string $value): string
|
|
{
|
|
return $value;
|
|
}
|
|
|
|
public function value(int $value): string
|
|
{
|
|
return "$value";
|
|
}
|
|
}
|
|
|
|
function main() {}
|
|
|