File tree Expand file tree Collapse file tree 2 files changed +46
-0
lines changed
Zend/tests/property_hooks Expand file tree Collapse file tree 2 files changed +46
-0
lines changed Original file line number Diff line number Diff line change 1+ --TEST--
2+ Final promoted property conflicts with non-promoted non-hooked property
3+ --FILE--
4+ <?php
5+
6+ class A {
7+ public function __construct (
8+ final $ prop
9+ ) {}
10+ }
11+
12+ class B extends A {
13+ public $ prop ;
14+ }
15+
16+ ?>
17+ --EXPECTF--
18+ Fatal error: Cannot override final property A::$prop in %s on line %d
Original file line number Diff line number Diff line change 1+ --TEST--
2+ Non-promoted constructor parameter does not conflict with final promoted property
3+ --FILE--
4+ <?php
5+
6+ class A {
7+ public function __construct (
8+ final $ prop
9+ ) {
10+ echo __METHOD__ . "(): $ prop \n" ;
11+ }
12+ }
13+
14+ class B extends A {
15+ public function __construct (
16+ $ prop
17+ ) {
18+ echo __METHOD__ . "(): $ prop \n" ;
19+ parent ::__construct ($ prop );
20+ }
21+ }
22+
23+ $ b = new B ("test " );
24+
25+ ?>
26+ --EXPECT--
27+ B::__construct(): test
28+ A::__construct(): test
You can’t perform that action at this time.
0 commit comments