Should the return type not be string|integer|double?
This check compares the return type specified in the @return annotation of a function
or method doc comment with the types returned by the function and raises an issue if they
mismatch.
Should the return type not be string|integer|double?
This check compares the return type specified in the @return annotation of a function
or method doc comment with the types returned by the function and raises an issue if they
mismatch.
Loading history...
61
*/
62
6
public function asNumber($value)
63
{
64
6
if ($value === null) {
65
1
return $this->nullValue;
66
}
67
68
5
return $this->normaliseValue($value);
69
}
70
71
/**
72
* Convert the supplied value into a valid number value
This check compares the return type specified in the @return annotation of a function
or method doc comment with the types returned by the function and raises an issue if they
mismatch.
Loading history...
76
*/
77
22
private function normaliseValue($value)
78
{
79
22
if (!is_numeric($value)) {
80
1
$value = 0;
81
1
}
82
// cast the value to int or float based on its true type
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.