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 ma

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"); } // ... } (b

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), an

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

2022-05-27 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

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