Inspection for number of parameters mismatch

Hello PhpStorm community,
I just came across a weird bug in one of our projects. I called a method which only has one parameter with 8 parameters, but there was no warning or error or whatsoever in PhpStorm. I checked the Inspections panel for Php under Preferences->Editor->Inspections but therewas no setting for invalid number of parameters. I have also enabled PhpMD but MessDetector also doesn't discover errors like these. Is there any possibility to make PhpStorm complain about PHP functions being called with the wrong number of arguments?

Thanks
Martin

1 comment
Comment actions Permalink

Hi there

I called a method which only has one parameter with 8 parameters, but there was no warning or error or whatsoever in PhpStorm.

Correct .. as you can pass more parameters than defined and PHP itself will not complain about it (you can then work with parameters via func_num_args() and func_get_args() functions)

Is there any possibility to make PhpStorm complain about PHP functions being called with the wrong number of arguments?

Not in currently available PhpStorm versions (v8.0.3). But it is implemented for v9 already.

0

Please sign in to leave a comment.