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 define their own functions that do take null and then run a find / replace or rector rule to convert them over.

I would still recommend ?? because it's the most future proof.

We have passed two RFCs in recent months which will eliminate default-nulls in 2 of the 3 major variable sources in the engine (the remaining one being arrays), and that too may eventually find itself promoted.

If it's a framework, I would suggest adding methods for explicitly getting a string that defaults to '' instead of null.

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

Reply via email to