Re: [RFC] [Discussion] Deprecate functions with overloaded signatures
| From: | Claude Pache | Date: | Mon, 29 May 2023 18:35:29 +0000 |
| Subject: | Re: [RFC] [Discussion] Deprecate functions with overloaded signatures | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-120434@lists.php.net to get a copy of this message | ||
> Le 27 avr. 2023 à 23:28, Máté Kocsis <kocsismate90@gmail.com> a écrit :
>
> Hi Internals,
>
> As you have possibly already experienced, overloaded signatures cause
> various smaller and bigger issues, while the concept is not natively
> supported by PHP. That's why I drafted an RFC which intends to phase out
> the majority of overloaded function/method signatures and also forbid
> the introduction of such functions in the future:
>
> https://wiki.php.net/rfc/deprecate_functions_with_overloaded_signatures
>
>
Hi Máté,
The replacement methods for IntlCalendar::set() (namely IntlCalendar::setDate() and
IntlCalendar::setDateTime()) must not have a return type of
void, but
true, like the original method, for the two following reasons:
1. By changing the returned value, you are introducing an unnecessary hazard when migrating code.
2. Per https://www.php.net/IntlCalendar, all
modification methods of that class (clear(), roll(), setTime(), etc.) consistently return
true on success and false on failure, even when the method is infallible
(and thus would always return true). Don’t break consistency.
—Claude