-
Notifications
You must be signed in to change notification settings - Fork 8k
Open
Description
Description
class A {
public const XYZ = 'hello';
public string $bar = '';
public function __construct($a) {
$this->bar = $a;
}
}
class B extends A {
#[DelayedTargetValidation]
#[Override]
public const XYZ = 'world';
public string $bar = 'asd';
#[DelayedTargetValidation]
#[Deprecated]
public string $ddd = 'asd';
}
$b = new B('a');
echo $b->ddd;
This code works in PHP <= 8.2 and >= 8.5
(the Deprecated case in <=8.3 and >= 8.5)
since #[DelayedTargetValidation] was only added in 8.5 - creating a gap of 8.3 and 8.4
This means that 2 important (since they're among the first that were implemented) built-in attributes can't be used for many use cases until at least 5 more years (looking at how common PHP 7.4 still is, despite it being unmaintained since years, just like how it was with PHP 5.6 too back then)
I'm not familiar if possible at all, but would it theoretically be possible to backport #[DelayedTargetValidation] to also work in 8.3 + 8.4?
Reactions are currently unavailable