1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

Fix divide by a floating point zero

The code was failing when dividing by 0.0.
This commit is contained in:
Andrew Boyton 2023-02-09 11:55:06 +11:00
parent 4eacb2f234
commit 5d976900d1

View File

@ -962,7 +962,7 @@ class ArithmeticOpAnalyzer
} elseif ($operation instanceof PhpParser\Node\Expr\BinaryOp\ShiftRight) {
$result = $operand1 >> $operand2;
} elseif ($operation instanceof PhpParser\Node\Expr\BinaryOp\Div) {
if ($operand2 === 0) {
if ($operand2 === 0 || $operand2 === 0.0) {
return Type::getNever();
}