xref: /php-src/Zend/tests/property_hooks/cpp.phpt (revision 780a8280)
1--TEST--
2Constructor property promotion
3--FILE--
4<?php
5
6class Test {
7    public function __construct(
8        public $prop = 42 {
9            get => print("Getting\n");
10            set { print("Setting\n"); }
11        }
12    ) {
13        echo "Constructor\n";
14    }
15}
16
17echo "Pre-test\n";
18$test = new Test;
19$test->prop;
20$test->prop = 42;
21
22$r = (new ReflectionProperty(Test::class, 'prop'));
23var_dump($r->hasDefaultValue());
24var_dump($r->getDefaultValue());
25
26?>
27--EXPECT--
28Pre-test
29Setting
30Constructor
31Getting
32Setting
33bool(false)
34NULL
35