Skip to content

Commit 5c9012d

Browse files
Fix tests
1 parent 7b09276 commit 5c9012d

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/vendor/
22
/composer.lock
33
/tests/tmp/
4+
.phpunit.result.cache

src/Extension/ReflectionExtension.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,9 @@ public function enterNode(Node $node): Node
249249
throw new ShouldNotHappenException();
250250
}
251251

252+
// Reset the cache to force a new computation
253+
$node->setAttribute('phpstan_cache_printer', null);
254+
252255
return $scope->getType($node);
253256
}
254257

tests/src/Rules/data/throws-php-internal-operators.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,25 @@ public function test(): void
1616
echo $a / 1;
1717
echo $a / 0; // error: Missing @throws DivisionByZeroError annotation
1818
echo $a / (rand(0, 1) === 0 ? 0 : 1); // error: Missing @throws DivisionByZeroError annotation
19-
echo $a / $b; // error: Missing @throws ArithmeticError annotation
19+
echo $a / $b; // error: Missing @throws DivisionByZeroError annotation
2020
echo (rand(0, 1) === 0 ? 20 : 10) / (rand(0, 1) === 0 ? 5 : 10);
2121

2222
echo $a /= 1;
2323
echo $a /= 0; // error: Missing @throws DivisionByZeroError annotation
2424
echo $a /= (rand(0, 1) === 0 ? 0 : 1); // error: Missing @throws DivisionByZeroError annotation
25-
echo $a /= $b; // error: Missing @throws ArithmeticError annotation
25+
echo $a /= $b; // error: Missing @throws DivisionByZeroError annotation
2626
echo $a /= (rand(0, 1) === 0 ? 5 : 10);
2727

2828
echo $a % 1;
2929
echo $a % 0; // error: Missing @throws DivisionByZeroError annotation
3030
echo $a % (rand(0, 1) === 0 ? 0 : 1); // error: Missing @throws DivisionByZeroError annotation
31-
echo $a % $b; // error: Missing @throws ArithmeticError annotation
31+
echo $a % $b; // error: Missing @throws DivisionByZeroError annotation
3232
echo (rand(0, 1) === 0 ? 20 : 10) % (rand(0, 1) === 0 ? 5 : 10);
3333

3434
echo $a %= 1;
3535
echo $a %= 0; // error: Missing @throws DivisionByZeroError annotation
3636
echo $a %= (rand(0, 1) === 0 ? 0 : 1); // error: Missing @throws DivisionByZeroError annotation
37-
echo $a %= $b; // error: Missing @throws ArithmeticError annotation
37+
echo $a %= $b; // error: Missing @throws DivisionByZeroError annotation
3838
echo $a %= (rand(0, 1) === 0 ? 5 : 10);
3939

4040
echo $a << 0;

0 commit comments

Comments
 (0)