- 创建了针对构造函数的命名参数调用测试 - 验证了字符串、整数和浮点数类型的参数传递 - 测试了参数顺序无关的传参机制 - 确保命名参数语法的正确解析和执行pull/1/head
parent
42dae8ceaa
commit
b6645e90ce
1 changed files with 18 additions and 0 deletions
@ -0,0 +1,18 @@ |
||||
--TEST-- |
||||
Named Arguments - PHP 8+ function call syntax |
||||
--FILE-- |
||||
<?php |
||||
class Foo { |
||||
public function __construct(string $a, int $b, float $c) { |
||||
var_dump($a, $b, $c); |
||||
} |
||||
} |
||||
|
||||
function main() { |
||||
$o = new Foo(b: 2026, c: 3.1415, a: "[content]"); |
||||
} |
||||
?> |
||||
--EXPECT-- |
||||
string(9) "[content]" |
||||
int(2026) |
||||
float(3.1415) |
||||
Loading…
Reference in new issue