Prefer "float" over "double"
thekid opened this issue · 1 comments
thekid commented
function similarity(string $a, string $b): double {
similar_text($a, $b, $p);
return $p;
}
The function above yields TypeError (Return value of related\similarity() must be an instance of double, float returned, while (double)
-casts work just as well as (float)
, and gettype(1.5)
even returns double (one of PHP's inconsistencies...)
- Add lang.Primitive::$FLOAT, deprecate lang.Primitive::$DOUBLE
- Change casts inside code
- Change
@param
/@return
and syntactic type hints - Replace doubleval() with floatval()
- Replace is_double() with is_float()
thekid commented
The failing tests are not due to this refactoring but stem from use lang\Object
being a (new) fatal error in PHP 7.2