Re: NULL Coercion Consistency
| From: | Christoph M. Becker | Date: | Wed, 20 Apr 2022 17:26:42 +0000 |
| Subject: | Re: NULL Coercion Consistency | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-117552@lists.php.net to get a copy of this message | ||
On 20.04.2022 at 19:02, Craig Francis wrote:
> In contrast, failing early at runtime, on something that is not actually a
> problem, like the examples in my RFC, creates 2 problems (primarily
> upgrading; but also adding unnecessary code to explicitly cast those
> possible NULL values to the correct type, which isn't needed for the other
> scalar types).
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>
--
Christoph M. Becker