psalm
psalm copied to clipboard
multiply or divide floats and ints: is it really an issue?
Psalm says "Cannot process ints and floats in strict binary operands mode, please cast explicitly"
but is that really an issue ?
https://psalm.dev/r/12263a8d9f
I found these snippets:
https://psalm.dev/r/12263a8d9f
<?php
function f(int $a, float $b): float {
return $a / $b;
}
function g(int $a, float $b): float {
return $b / $a;
}
function h(int $a, int $b): float {
return $a / $b;
}
function i(int $a, float $b): float {
return $a * $b;
}
function j(int $a, float $b): float {
return $b * $a;
}
Psalm output (using commit 2f8ed4d):
ERROR: InvalidOperand - 4:12 - Cannot process ints and floats in strict binary operands mode, please cast explicitly
ERROR: InvalidOperand - 8:12 - Cannot process ints and floats in strict binary operands mode, please cast explicitly
ERROR: InvalidOperand - 16:12 - Cannot process ints and floats in strict binary operands mode, please cast explicitly
ERROR: InvalidOperand - 20:12 - Cannot process ints and floats in strict binary operands mode, please cast explicitly
Did you find a solution? Facing same issue.
Did you find a solution? Facing same issue.
add a psalm-baseline.xml ... and ignore it.