1.2.258. Could Be Float¶
Mark arguments, class constants, properties and return types that can be set to
float
.
<?php
// Accept an int as input
function foo($b) {
// Returns a float (cubic root of $b);
return pow($b, 1 / 3);
}
?>
1.2.258.1. Connex PHP features¶
1.2.258.1.1. Suggestions¶
Add float typehint to the code.
1.2.258.1.2. Specs¶
Short name |
Typehints/CouldBeFloat |
Rulesets |
All, CE, Typechecks |
Exakat since |
2.1.4 |
PHP Version |
All |
Severity |
Major |
Time To Fix |
Quick (30 mins) |
Precision |
High |
Available in |