1--TEST-- 2Constructor promotiong mixed with other properties, parameters and code 3--FILE-- 4<?php 5 6class Test { 7 public string $prop2; 8 9 public function __construct(public string $prop1 = "", $param2 = "") { 10 $this->prop2 = $prop1 . $param2; 11 } 12} 13 14var_dump(new Test("Foo", "Bar")); 15echo "\n"; 16echo new ReflectionClass(Test::class), "\n"; 17 18?> 19--EXPECTF-- 20object(Test)#1 (2) { 21 ["prop2"]=> 22 string(6) "FooBar" 23 ["prop1"]=> 24 string(3) "Foo" 25} 26 27Class [ <user> class Test ] { 28 @@ %s 29 30 - Constants [0] { 31 } 32 33 - Static properties [0] { 34 } 35 36 - Static methods [0] { 37 } 38 39 - Properties [2] { 40 Property [ public string $prop2 ] 41 Property [ public string $prop1 ] 42 } 43 44 - Methods [1] { 45 Method [ <user, ctor> public method __construct ] { 46 @@ %s 47 48 - Parameters [2] { 49 Parameter #0 [ <optional> string $prop1 = '' ] 50 Parameter #1 [ <optional> $param2 = '' ] 51 } 52 } 53 } 54} 55