1.2.1456. Wrong Argument Type¶
Checks that the type of the argument is consistent with the type of the called method.
This analysis is valid since PHP 8.0.
<?php
function foo(int $a) { }
//valid call, with an integer
foo(1);
//invalid call, with a string
foo('asd');
?>
1.2.1456.2. Connex PHP features¶
1.2.1456.2.1. Suggestions¶
Always use a valid type when calling methods.
1.2.1456.2.2. Specs¶
Short name |
Functions/WrongArgumentType |
Rulesets |
|
Exakat since |
2.1.3 |
PHP Version |
With PHP 8.0 and more recent |
Severity |
Minor |
Time To Fix |
Quick (30 mins) |
Precision |
Very high |
Available in |