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.
45 lines
714 B
45 lines
714 B
--TEST--
|
|
Trait members compare evaluated values instead of source spelling
|
|
--FILE--
|
|
<?php
|
|
enum Status: string
|
|
{
|
|
case Active = 'active';
|
|
}
|
|
|
|
trait FirstValues
|
|
{
|
|
public const int SCORE = 1 + 1;
|
|
public array $items = [1, 2];
|
|
public Status $status = Status::Active;
|
|
}
|
|
|
|
trait SecondValues
|
|
{
|
|
public const int SCORE = 2;
|
|
public array $items = array(1, 2);
|
|
public Status $status = Status::Active;
|
|
}
|
|
|
|
class Values
|
|
{
|
|
use FirstValues, SecondValues;
|
|
}
|
|
|
|
function main(): void
|
|
{
|
|
$values = new Values();
|
|
var_dump(Values::SCORE);
|
|
var_dump($values->items);
|
|
var_dump($values->status === Status::Active);
|
|
}
|
|
?>
|
|
--EXPECT--
|
|
int(2)
|
|
array(2) {
|
|
[0]=>
|
|
int(1)
|
|
[1]=>
|
|
int(2)
|
|
}
|
|
bool(true)
|
|
|