On 11/03/2025 06:32, Gina P. Banyard wrote:
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.


I dedicated a whole section in a previous RFC to making essentially this same argument: https://wiki.php.net/rfc/deprecate-bareword-strings#e_warning_vs_e_deprecated

The underlying problem is that "deprecation" isn't really a "severity", it's more a "category" of messages. It should maybe be a separate flag combined with the severity, so that E_DEPRECATION_NOTICE=E_NOTICE|E_DEPRECATED, and E_DEPRECATION_WARNING=E_WARNING|E_DEPRECATED

That way we could signal the difference between "this is bad, but the behaviour will remain well-defined" (e.g. file I/O warnings, which would require a completely new API to eliminate) and "this is bad, and there are concrete plans to change it" (e.g. it will become an error, or start doing something different, in the next major version).


--
Rowan Tommins
[IMSoP]

Reply via email to