Re: Re: RFC: Marking return values as important (#[\NoDiscard])
| From: | Jakob Givoni | Date: | Fri, 14 Feb 2025 14:00:55 +0000 |
| Subject: | Re: Re: RFC: Marking return values as important (#[\NoDiscard]) | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-126411@lists.php.net to get a copy of this message | ||
On Fri, Feb 14, 2025 at 1:10 PM Aleksander Machniak <alec@alec.pl> wrote:
> On 14.02.2025 12:57, Derick Rethans wrote:
> > None of the current attributes (ReturnTypeWillChange,
> > AllowDynamicProperties, SensitiveParameter, Override, and Deprecated)
> > change the behaviour of how a program runs. They only add warnings. with
> > the exception of AllowDynamicProperties to be an actual 'feature' in PHP
> > 9.0 (now it's only a deprecation warning silencer).
>
> For clarity, it's not AllowDynamicProperties attribute throwing an
> exception in PHP9, it's use of a "dynamic" property on an object not
> marked with this attribute. So, I'm not sure it's a valid exception to
> the rule.
>
>
You're absolutely right that it's not the use of the property that causes
exceptions
to be thrown, *but it's still a valid exception* to the rule, since the use
of the property
changes how a program runs (which was the point that was being made).
Best,
Jakob