On 13 Dec 2022, at 15:45, Rowan Tommins <rowan.coll...@gmail.com> wrote:
> Although presumably they return null rather than an empty string precisely so 
> that users can check if the value was provided, without providing an extra 
> method equivalent to isset($_GET['q']), e.g.
> 
> [...]
> 
> For cases where you don't need that distinction, Laravel, Symfony, and 
> CakePHP all allow a default to be passed as the second parameter.


Yep, that's right... but it's not easy to know if that distinction is needed 
for every single variable (why it's easier to work around this issue at the 
sinks, as Rector now does).

I assume the next step is for PHP is to deprecate null coercion for all 
contests; e.g. concat ('Search: ' . $search), comparisons ('' != null), 
arithmetic, and the remaining functions like print()/echo()/sprintf('%s')... 
and then deprecate all other forms of coercion (e.g. 5 + '3')... because that 
will be fun :-)

Craig

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to