Skip to content

Commit 684c599

Browse files
committed
Added regression test
1 parent b5ecab0 commit 684c599

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

tests/PHPStan/Rules/Comparison/ConstantLooseComparisonRuleTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,4 +225,15 @@ public function testBug11694(): void
225225
$this->analyse([__DIR__ . '/data/bug-11694.php'], $expectedErrors);
226226
}
227227

228+
public function testBug8800(): void
229+
{
230+
$this->treatPhpDocTypesAsCertain = true;
231+
$this->analyse([__DIR__ . '/data/bug-8800.php'], [
232+
[
233+
'Loose comparison using == between 0|1|false and 2 will always evaluate to false.',
234+
9,
235+
],
236+
]);
237+
}
238+
228239
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace Bug8800;
4+
5+
class HelloWorld
6+
{
7+
public function sayHello(string $s): void
8+
{
9+
var_dump(preg_match('{[A-Z]}', $s) == 2);
10+
}
11+
}

0 commit comments

Comments
 (0)