1.2.1073. Semantic Typing¶
Arguments names are only useful inside the method’s body. They are not actual type.
<?php
// arguments should be a string and an array
function foo($array, $str) {
// more code
return $boolean;
}
// typehint is actually checking the values
function bar(iterable $closure) : bool {
// more code
return true;
}
?>
1.2.1073.1. Connex PHP features¶
1.2.1073.1.1. Suggestions¶
Use a typehint to make sure the argument is of the expected type.
1.2.1073.1.2. Specs¶
Short name |
Functions/SemanticTyping |
Rulesets |
|
Exakat since |
2.0.5 |
PHP Version |
All |
Severity |
Minor |
Time To Fix |
Quick (30 mins) |
Precision |
Very high |
Available in |