[PHP-DEV] Re: NULL Coercion Consistency

2022-10-20 Thread Craig Francis
On 28 May 2022, at 03:36, Craig Francis wrote: > On 8 Apr 2022, at 18:34, Craig Francis wrote: >> I've written a new draft RFC to address the NULL coercion problems: >> https://wiki.php.net/rfc/null_coercion_consistency > > > I give up. For everyone affected by this... Rector has a

Re: [PHP-DEV] Re: NULL Coercion Consistency

2022-05-30 Thread Guilliam Xavier
On Mon, May 30, 2022 at 4:59 PM Rowan Tommins wrote: > > The actual code in this case ended up in a generic routine that used > isset() to choose which SQL to generate. An empty string would generate > a WHERE clause that matched zero rows, but a null would omit the WHERE > clause entirely, and

Re: [PHP-DEV] Re: NULL Coercion Consistency

2022-05-30 Thread Rowan Tommins
On 30/05/2022 15:04, Guilliam Xavier wrote: For this specific example, shouldn't it rather [already] be like this anyway? function getByIdentifier(string $identifier) { if ( $identifier === '' ) { throw new InvalidArgumentException("Empty identifier"); } // ... }

Re: [PHP-DEV] Re: NULL Coercion Consistency

2022-05-30 Thread Guilliam Xavier
On Tue, May 24, 2022 at 10:47 AM Rowan Tommins wrote: > > As an anecdote, I was recently working on a bug involving nulls causing > unintended behaviour in an API. As part of the clean-up, I changed a > function signature from getByIdentifer($identifier) to > getByIdentifer(string $identifier),

[PHP-DEV] Re: NULL Coercion Consistency

2022-05-28 Thread Mark Randall
On 28/05/2022 03:36, Craig Francis wrote: In this case, two of my clients are considering the cost of modifying their code (by adding a load of `?? ''` everywhere), and they would rather avoid that (time consuming, and makes their code more complicated). Alternatively, they may wish to

Re: [PHP-DEV] Re: NULL Coercion Consistency

2022-05-28 Thread Aleksander Machniak
On 28.05.2022 04:36, Craig Francis wrote: On 8 Apr 2022, at 18:34, Craig Francis wrote: I've written a new draft RFC to address the NULL coercion problems: https://wiki.php.net/rfc/null_coercion_consistency I give up. Don't give up. You have my Yes vote. Imo, the RFC: - fixes real upgrade

[PHP-DEV] Re: NULL Coercion Consistency

2022-05-27 Thread Craig Francis
On 8 Apr 2022, at 18:34, Craig Francis wrote: > I've written a new draft RFC to address the NULL coercion problems: > https://wiki.php.net/rfc/null_coercion_consistency I give up. I'm clearly not clever enough to understand what the benefits are for breaking NULL coercion... considering

Re: [PHP-DEV] Re: NULL Coercion Consistency

2022-05-24 Thread Rowan Tommins
On 23/05/2022 19:45, Craig Francis wrote: For those against my RFC, can you take a quick look at this patch for Laravel: https://github.com/laravel/framework/pull/36262/files#diff-15b0a3e2eb2d683222d19dfacc04c616a3db4e3d3b3517e96e196ccbf838f59eR118

[PHP-DEV] Re: NULL Coercion Consistency

2022-05-23 Thread Craig Francis
On 8 Apr 2022, at 18:34, Craig Francis wrote: > I've written a new draft RFC to address the NULL coercion problems: > https://wiki.php.net/rfc/null_coercion_consistency > For those against my RFC, can you take a quick look at this patch for

[PHP-DEV] Re: NULL Coercion Consistency

2022-05-06 Thread Craig Francis
On 6 May 2022, at 16:26, Björn Larsson wrote: > Den 2022-04-08 kl. 19:34, skrev Craig Francis: >> Hi, >> I've written a new draft RFC to address the NULL coercion problems: >> https://wiki.php.net/rfc/null_coercion_consistency >> ... > > One code pattern to upgrade your code to PHP 8.1 and 9.0

[PHP-DEV] Re: NULL Coercion Consistency

2022-05-06 Thread Björn Larsson via internals
Den 2022-04-08 kl. 19:34, skrev Craig Francis: Hi, I've written a new draft RFC to address the NULL coercion problems: https://wiki.php.net/rfc/null_coercion_consistency This is due to the result of the Allow NULL quiz: https://quiz.craigfrancis.co.uk/ 14 votes for Fatal Type Errors