Re: NULL Coercion Consistency

From: Date: Sat, 28 May 2022 16:48:53 +0000
Subject: Re: NULL Coercion Consistency
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-117818@lists.php.net to get a copy of this message
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.

« previous php.internals (#117818) next »