ctor_promotion_trait.phpt 257 B

123456789101112131415161718192021
  1. --TEST--
  2. Constructor promotion can be used inside a trait
  3. --FILE--
  4. <?php
  5. trait Test {
  6. public function __construct(public $prop) {}
  7. }
  8. class Test2 {
  9. use Test;
  10. }
  11. var_dump(new Test2(42));
  12. ?>
  13. --EXPECT--
  14. object(Test2)#1 (1) {
  15. ["prop"]=>
  16. int(42)
  17. }