Hi Claude,

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.

1.  I don't see much risk with this change, since we clearly indicate at
the very beginning that the new methods return void, so programmers
migrating their code
should pay attention to the return types. IDEs and static analysers can
surely warn them in case of inattention.

2. Some of the methods you mentioned have a "true" return type for a few
weeks now. The biggest motivation for introducing these was to at least
have some chance to
make them void in the future. Doing so is a risky move indeed, so should be
carried out very carefully, if it's possible at all... That's why I
consider it beneficial to spare the
effort and start with a clean slate by adding the new methods in question
with their correct return type.


Reply via email to