3
There is a proposal to unify the behavior of userland and internal functions in the PHP 8. That currently in particular, when internal functions fail to parse argument types correctly, they fail to return null. The functions of Userland launch a Typeerror.
Regarding what would be the best behavior, I believe that launch a Typeerror, would be the best behavior.
One could exemplify. An explanation in code of such behaviors currently. Also, if possible, about this such unification.
Thank you. I read and found this ex. by the link. "For user-defined functions, passing an illegal type parameter results in a Typeerror. For internal functions, the behavior depends on several factors, but the default is to launch a warning and return null. This RFC consistently proposes to generate Typeerror exceptions for all types of invalid parameters, regardless of whether the function is defined by the user or by extension."
function foo(int $bar) {}
foo("not an int"); 
// TypeError: Argument 1 passed to foo() must be of the type int, string given
– Fabiano Monteiro