1--TEST-- 2Named params in new in const expr 3--FILE-- 4<?php 5 6class Vec { 7 public function __construct(public float $x, public float $y, public float $z) {} 8} 9 10static $a = new Vec(x: 0.0, y: 1.0, z: 2.0); 11var_dump($a); 12 13static $b = new Vec(z: 0.0, y: 1.0, x: 2.0); 14var_dump($b); 15 16static $c = new Vec(0.0, z: 1.0, y: 2.0); 17var_dump($c); 18 19try { 20 eval('static $d = new Vec(x: 0.0, x: 1.0);'); 21} catch (Error $e) { 22 echo $e->getMessage(), "\n"; 23} 24 25?> 26--EXPECT-- 27object(Vec)#1 (3) { 28 ["x"]=> 29 float(0) 30 ["y"]=> 31 float(1) 32 ["z"]=> 33 float(2) 34} 35object(Vec)#2 (3) { 36 ["x"]=> 37 float(2) 38 ["y"]=> 39 float(1) 40 ["z"]=> 41 float(0) 42} 43object(Vec)#3 (3) { 44 ["x"]=> 45 float(0) 46 ["y"]=> 47 float(2) 48 ["z"]=> 49 float(1) 50} 51Named parameter $x overwrites previous argument 52