Re: Re: [RFC] Increment/Decrement Fixes

From: Date: Wed, 01 Sep 2021 08:13:09 +0000
Subject: Re: Re: [RFC] Increment/Decrement Fixes
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-115910@lists.php.net to get a copy of this message
On Sun, Mar 8, 2020 at 8:31 PM Rowan Tommins <rowan.collins@gmail.com> wrote: > On 01/03/2020 21:23, Rowan Tommins wrote: > > https://wiki.php.net/rfc/increment_decrement_fixes > > > Hi all, > > I have just posted a substantially rewritten version of the above RFC. > > * The proposal to change boolean behaviour has been dropped. > * More justification has been included for treating nulls differently. > * The suggestion of raising errors just for the currently broken > operators has been explicitly addressed. > > I would urge anyone who reacted instinctively to the original proposal > to read this version, and engage with the reasoning it presents, even if > they disagree with my conclusions. > For the record, increment/decrement on arrays, resources and objects now throws due to https://wiki.php.net/rfc/arithmetic_operator_type_checks. Personally I think it's fine to change the behavior of "$null--", to make it consistent with "$null - 1" and "$null++". Making "$null--" into a TypeError should imho only be done if we also make other arithmetic on null a TypeError (e.g. $null + 1, $null * 2, etc.) Regards, Nikita

« previous php.internals (#115910) next »