Answer the question
In order to leave comments, you need to log in
What's the best way to handle the incomplete declaration of parameters of your own function in PHP?
I think what needs to be done with the function so that if it is incorrectly declared, the entire site does not fall through the code, a notification would be displayed in some form at most that the parameter is such and such (namely, the name, and not just what it is in a row, as the handler does PHP default) is not set. Is there any way to do this correctly and correctly?
Answer the question
In order to leave comments, you need to log in
Check arguments with https://wiki.php.net/rfc/argument_unpacking
And throw InvalidArgumentException
Like a fish needs a bicycle?
What does the incorrect declaration mean - I did not specify a required parameter in the code? The ide should take care of this and highlight the usage error for me. If not what was expected is passed there, the problem is not in the function, but in the code that transmits the data, like so. Or did I misunderstand the question? An example in the studio!
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question