Skip to content

Commit 6b11fd2

Browse files
Update for #[\Override] on properties
See php#19061
1 parent 5017426 commit 6b11fd2

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
--TEST--
2+
#[\DelayedTargetValidation] with #[\Override]: non-overrides still error (normal property)
3+
--FILE--
4+
<?php
5+
6+
class DemoClass {
7+
8+
#[DelayedTargetValidation]
9+
#[Override] // Does something here
10+
public string $prop;
11+
}
12+
13+
?>
14+
--EXPECTF--
15+
Fatal error: DemoClass::$prop has #[\Override] attribute, but no matching parent property exists in %s on line %d

Zend/tests/attributes/delayed_target_validation/with_Override_okay.phpt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
class Base {
77

8+
public $val;
9+
810
public string $hooked {
911
get => $this->hooked;
1012
set => $value;
@@ -19,7 +21,7 @@ class Base {
1921
#[Override] // Does nothing here
2022
class DemoClass extends Base {
2123
#[DelayedTargetValidation]
22-
#[Override] // Does nothing here
24+
#[Override] // Does something here
2325
public $val;
2426

2527
public string $hooked {

0 commit comments

Comments
 (0)