Skip to content

Commit 386d308

Browse files
Add test
1 parent 673c613 commit 386d308

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

tests/PHPStan/Rules/Comparison/ImpossibleCheckTypeFunctionCallRuleTest.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1198,7 +1198,13 @@ public function testBug13566(): void
11981198
public function testBug13799(): void
11991199
{
12001200
$this->treatPhpDocTypesAsCertain = true;
1201-
$this->analyse([__DIR__ . '/data/bug-13799.php'], []);
1201+
$this->analyse([__DIR__ . '/data/bug-13799.php'], [
1202+
[
1203+
'Call to function in_array() with arguments \'c\', list<\'a\'|\'b\'> and true will always evaluate to false.',
1204+
24,
1205+
'Because the type is coming from a PHPDoc, you can turn off this check by setting <fg=cyan>treatPhpDocTypesAsCertain: false</> in your <fg=cyan>%configurationFile%</>.',
1206+
],
1207+
]);
12021208
}
12031209

12041210
}

tests/PHPStan/Rules/Comparison/data/bug-13799.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,7 @@ function get_whitelist(): array {
2020
if (in_array('a', get_whitelist(), true)) {
2121
echo 'ok';
2222
}
23+
24+
if (in_array('c', get_whitelist(), true)) {
25+
echo 'ok';
26+
}

0 commit comments

Comments
 (0)