On Wed, 20 Apr 2022 at 18:26, Christoph M. Becker <cmbecke...@gmx.de> wrote:

> Null is *not* a scalar type[1], though.  This is the reason why it is
> not coerced for userland functions using *scalar* type hints with
> coercive typing.
>
> [1] <https://www.php.net/is_scalar>
>


But why not? and how many developers actually care how PHP has defined a
scalar type and how that relates to coercion specifically (and only) with
functions?

Bit of a tangent, I could argue that NULL is closer to a simple
string/int/float/bool, than a complex array/resource/object (well, an
object without a __toString method)... or in other words, NULL is a simple
value that is coerced perfectly well in other contexts, and has
been coerced for internal functions since, well, forever.

Anyway, the problem I'm trying to solve is the backwards compatibility
issue this is causing, and how it will affect upgrading when it becomes a
Fatal Type Error... if you have any suggestions on how to solve this,
please let me know, for now this is the best solution I've got.

Craig

Reply via email to