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.
61 lines
962 B
61 lines
962 B
--TEST--
|
|
Trait parent constructor calls keep declarations aligned for aliased and direct wrappers
|
|
--FILE--
|
|
<?php
|
|
|
|
class Base
|
|
{
|
|
public function __construct(array $options = [])
|
|
{
|
|
var_dump($options);
|
|
}
|
|
}
|
|
|
|
trait DriverConstructor
|
|
{
|
|
public function __construct(array $options = [])
|
|
{
|
|
$options['trait'] = 1;
|
|
parent::__construct($options);
|
|
}
|
|
}
|
|
|
|
class AliasedDriver extends Base
|
|
{
|
|
use DriverConstructor {
|
|
__construct as private traitConstruct;
|
|
}
|
|
|
|
public function __construct(array $options = [])
|
|
{
|
|
$options['alias'] = 1;
|
|
$this->traitConstruct($options);
|
|
}
|
|
}
|
|
|
|
class DirectDriver extends Base
|
|
{
|
|
use DriverConstructor;
|
|
}
|
|
|
|
function main()
|
|
{
|
|
new AliasedDriver(['input' => 1]);
|
|
new DirectDriver(['direct' => 1]);
|
|
}
|
|
?>
|
|
--EXPECT--
|
|
array(3) {
|
|
["input"]=>
|
|
int(1)
|
|
["alias"]=>
|
|
int(1)
|
|
["trait"]=>
|
|
int(1)
|
|
}
|
|
array(2) {
|
|
["direct"]=>
|
|
int(1)
|
|
["trait"]=>
|
|
int(1)
|
|
}
|
|
|