1.2.250. 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.250.1. Suggestions¶
Add
bool
typehint to the code.
1.2.250.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 |
Features |
class |
Available in |