Skip to content

Commit 0497f56

Browse files
VincentLangletondrejmirtes
authored andcommitted
Add non regression tests for strict rules issues
1 parent a8a68f1 commit 0497f56

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

tests/PHPStan/Rules/Comparison/ImpossibleCheckTypeFunctionCallRuleTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,6 +1007,18 @@ public function testBug12755(): void
10071007
]);
10081008
}
10091009

1010+
public function testBugStrictRule147(): void
1011+
{
1012+
$this->treatPhpDocTypesAsCertain = true;
1013+
$this->analyse([__DIR__ . '/data/bug-strict-147.php'], []);
1014+
}
1015+
1016+
public function testBugStrictRule143(): void
1017+
{
1018+
$this->treatPhpDocTypesAsCertain = true;
1019+
$this->analyse([__DIR__ . '/data/bug-strict-143.php'], []);
1020+
}
1021+
10101022
public function testBug12412(): void
10111023
{
10121024
$this->treatPhpDocTypesAsCertain = true;
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace BugStrict143;
4+
5+
function foo(string $key, array $arr): void {
6+
$found = array_key_exists($key . 'foo', $arr) && array_key_exists($key . 'bar', $arr);
7+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace BugStrict147;
4+
5+
$array = ['a', 'c', 'b'];
6+
asort($array);
7+
if (array_is_list($array)) {
8+
print 'array was in order';
9+
}

0 commit comments

Comments
 (0)