1.2.251. Could Be Boolean¶
Reports arguments, properties, return types and class constants that can be typed boolean.
<?php
// Accept a boolean as input
function foo($b) {
// Returns a boolean
return $b === true;
}
?>
See also class.
1.2.251.1. Connex PHP features¶
1.2.251.1.1. Suggestions¶
Add
bool
typehint to the code.
1.2.251.1.2. Specs¶
Short name |
Typehints/CouldBeBoolean |
Rulesets |
|
Exakat since |
2.1.2 |
PHP Version |
All |
Severity |
Major |
Time To Fix |
Quick (30 mins) |
Precision |
High |
Available in |