LMSouq
general-dev Open

Cannot pass null argument when using type hinting

AB
Abdullah
1 month ago
3 views
Problem Description
The following code: ```php class Type { } function foo(Type $t) { } foo(null); ``` failed at run time: > PHP Fatal error: Argument 1 passed to foo() must not be null Why is it not allowed to pass null just like other languages?

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base