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.
 
 

33 lines
606 B

--TEST--
Symfony pattern: context array union keeps left-hand keys
--FILE--
<?php
class SymfonyLikeSender
{
}
function logContext(object $message, string $alias, object $sender): array
{
$context = [
'class' => $message::class,
'alias' => 'existing',
];
return $context + ['alias' => $alias, 'sender' => $sender::class];
}
function main(): void
{
var_dump(logContext(new stdClass(), 'async', new SymfonyLikeSender()));
}
?>
--EXPECT--
array(3) {
["class"]=>
string(8) "stdClass"
["alias"]=>
string(8) "existing"
["sender"]=>
string(17) "SymfonyLikeSender"
}