Skip to content

Commit 6475a39

Browse files
Add a few more tests
1 parent cca1e8d commit 6475a39

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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

0 commit comments

Comments
 (0)