[doc-en] master: DelayedTargetValidation: keep the first example valid on PHP 8.6 (#6032)
| From: | Alejandro Borrego via GitHub | Date: | Wed, 04 Nov 2026 08:24:08 +0000 |
| Subject: | [doc-en] master: DelayedTargetValidation: keep the first example valid on PHP 8.6 (#6032) | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-23910@lists.php.net to get a copy of this message | ||
Author: Alejandro Borrego (abp002)
Committer: GitHub (web-flow)
Pusher: lacatoire
Date: 2026-11-04T09:24:05+01:00
Commit: https://github.com/php/doc-en/commit/aeea14601ab64883520b4dfee1c79bafb210748b
Raw diff: https://github.com/php/doc-en/commit/aeea14601ab64883520b4dfee1c79bafb210748b.diff
DelayedTargetValidation: keep the first example valid on PHP 8.6 (#6032)
* DelayedTargetValidation: keep the first example valid on PHP 8.6
* Apply suggestion from review
Co-authored-by: Louis-Arnaud <20201470+lacatoire@users.noreply.github.com>
---------
Co-authored-by: Alejandro Borrego <210245044+abp002@users.noreply.github.com>
Co-authored-by: Louis-Arnaud <20201470+lacatoire@users.noreply.github.com>
Changed paths:
M language/predefined/attributes/delayedtargetvalidation.xml
Diff:
diff --git a/language/predefined/attributes/delayedtargetvalidation.xml
b/language/predefined/attributes/delayedtargetvalidation.xml
index 1467f994c018..8ac949209328 100644
--- a/language/predefined/attributes/delayedtargetvalidation.xml
+++ b/language/predefined/attributes/delayedtargetvalidation.xml
@@ -46,6 +46,8 @@
<?php
class Base {
+ public const NAME = 'base';
+
protected function foo(): void {}
}
@@ -63,6 +65,10 @@ class Child extends Base {
<simpara>
On PHP versions where <classname>Override</classname> is not allowed on
class constants, this does not produce a compile time error.
+ As of PHP 8.6.0, <classname>Override</classname> can target class constants,
+ and <literal>Child::NAME</literal> overrides
<literal>Base::NAME</literal>,
+ <classname>DelayedTargetValidation</classname> is then no longer needed
+ here, and the reflection example below no longer throws for it.
</simpara>
</example>