On 21-02-2022 10:04, Christoph M. Becker wrote:
That "inconsistency" had been introduced with PHP 7.0.0, i.e. right when scalar type declarations have been introduced. Passing a null to a non-nullable parameter of a *userland* function throws a TypeError: <https://3v4l.org/lbF4h>. As of PHP 8.1.0, internal functions behave the same as userland function in this regard.
In my view, consistency between internal and userland functions brings a lot of value, and not only for the language itself. As soon as internal and userland become fully consistent it will become a lot easier to write "internal" functions in PHP rather than C. Not only will that make developing the standard library easier, it may also make the optimizer and JIT compiler more effective. The more consistency the better.
Approaches 2 and 3 from the RFC are a step in the right direction. Regards, Dik Takken -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php