From 2d6240e7b370e172d8d5134d8eb9a0cee6be69c1 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Wed, 11 Sep 2024 08:41:41 +0200 Subject: [PATCH] more tests --- .../Operators/InvalidBinaryOperationRuleTest.php | 4 ++-- .../Rules/Operators/data/invalid-division.php | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/tests/PHPStan/Rules/Operators/InvalidBinaryOperationRuleTest.php b/tests/PHPStan/Rules/Operators/InvalidBinaryOperationRuleTest.php index 328ae1c739b..d456391d0f5 100644 --- a/tests/PHPStan/Rules/Operators/InvalidBinaryOperationRuleTest.php +++ b/tests/PHPStan/Rules/Operators/InvalidBinaryOperationRuleTest.php @@ -892,7 +892,7 @@ public function dataDivisionByMaybeZero(): iterable ], [ 'Binary operation "/" between int and -5|int<0, max> might result in an error.', - 115, + 123, ], ], ]; @@ -930,7 +930,7 @@ public function dataDivisionByMaybeZero(): iterable ], [ 'Binary operation "/" between int and -5|int<0, max> might result in an error.', - 115, + 123, ], ], ]; diff --git a/tests/PHPStan/Rules/Operators/data/invalid-division.php b/tests/PHPStan/Rules/Operators/data/invalid-division.php index d93f92f0a3c..ce444b7bbbb 100644 --- a/tests/PHPStan/Rules/Operators/data/invalid-division.php +++ b/tests/PHPStan/Rules/Operators/data/invalid-division.php @@ -75,7 +75,7 @@ function throws(int $i, int $x) { return $i / $x; }; -class DivideFloats +class Divide { public function doDiv(int $y, float $x): void { @@ -99,12 +99,20 @@ public function doDiv2(int $y, $benevolentMaybeFloat): void } /** - * @param __benevolent $benevolentMaybeString + * @param __benevolent $benevolent */ - public function doDiv3(int $y, $benevolentMaybeString): void + public function doDiv3(int $y, $benevolent): void { - echo $y / $benevolentMaybeString; + echo $y / $benevolent; } + + /** + * @param __benevolent $benevolent + */ + public function doDiv4(int $y, $benevolent): void + { + echo $y / $benevolent; + } } /**