summaryrefslogtreecommitdiff
path: root/Zend/tests/ctor_promotion_mixing.phpt
blob: a527654e793f561a6f8a206d3b4d86892faeae26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
--TEST--
Constructor promotiong mixed with other properties, parameters and code
--FILE--
<?php

class Test {
    public string $prop2;

    public function __construct(public string $prop1 = "", $param2 = "") {
        $this->prop2 = $prop1 . $param2;
    }
}

var_dump(new Test("Foo", "Bar"));
echo "\n";
echo new ReflectionClass(Test::class), "\n";

?>
--EXPECTF--
object(Test)#1 (2) {
  ["prop2"]=>
  string(6) "FooBar"
  ["prop1"]=>
  string(3) "Foo"
}

Class [ <user> class Test ] {
  @@ %s

  - Constants [0] {
  }

  - Static properties [0] {
  }

  - Static methods [0] {
  }

  - Properties [2] {
    Property [ public string $prop2 ]
    Property [ public string $prop1 ]
  }

  - Methods [1] {
    Method [ <user, ctor> public method __construct ] {
      @@ %s

      - Parameters [2] {
        Parameter #0 [ <optional> string $prop1 = '' ]
        Parameter #1 [ <optional> $param2 = '' ]
      }
    }
  }
}