On Monday, 10 March 2025 at 23:07, Jorg Sowa <jorg.s...@gmail.com> wrote:

> Hello everyone,
>
> I’d like to align on the approach to validating arguments for built-in 
> functions (usually for flag inputs). Some ongoing discussions in PRs:
> - https://github.com/php/php-src/pull/15647
> - https://github.com/php/php-src/pull/15883
> - https://github.com/php/php-src/pull/17859
>
> In some cases, changes introduced ValueError immediately in the next version, 
> without a deprecation phase. To ensure a consistent approach, I propose the 
> following:
>
> 1. Introduce a deprecation notice in the next minor version.
> 2. Raise a ValueError in the following minor version.
>
> If needed, I can create RFC, but as described by a few people in the 
> discussions, we can avoid it having the consensus. What do you think?

My opinion on this topic is well known, validation errors should go straight to 
a ValueError.
And if not a ValueError then it should be an E_WARNING.
Raising a deprecation is frankly non-sensical.
Validation errors exist to inform the person programing that there is an error 
with the call site that is preventable very easily.
If we start emitting E_DEPRECATED instead of E_WARNING/throwing a ValueError, 
we are incentivising people to add throwing error handlers for E_DEPRECATED,
something that I (and I know others too) lament constantly, as a deprecation is 
not an error.

Best regards,

Gina P. Banyard

>

Reply via email to