1.2.286. Could Type With Boolean¶
That argument, property or method may be typed with bool
. Based on usage, it was determined that the only type possible is a boolean.
<?php
// $a is used with a function which requires a boolean.
function foo($code, $a) {
return var_dump($code, $a);
}
?>
See also Type declarations.
1.2.286.1. Connex PHP features¶
1.2.286.1.1. Suggestions¶
Add the
bool
typehint to the function.
1.2.286.1.2. Specs¶
Short name |
Functions/CouldTypeWithBool |
Rulesets |
|
Exakat since |
1.9.9 |
PHP Version |
All |
Severity |
Minor |
Time To Fix |
Quick (30 mins) |
Precision |
Very high |
Available in |