Skip to content

Commit 0b78c55

Browse files
committed
Test ConstantArrayType::getOffsetValueType() with imprecise offset type
1 parent 2fb6632 commit 0b78c55

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

tests/PHPStan/Analyser/NodeScopeResolverTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ public function dataFileAsserts(): iterable
164164
yield from $this->gatherAssertTypes(__DIR__ . '/data/classPhpDocs.php');
165165
yield from $this->gatherAssertTypes(__DIR__ . '/data/non-empty-array-key-type.php');
166166
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-3133.php');
167+
yield from $this->gatherAssertTypes(__DIR__ . '/../Rules/Variables/data/bug-10577.php');
167168
yield from $this->gatherAssertTypes(__DIR__ . '/../Rules/Comparison/data/bug-2550.php');
168169
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-2899.php');
169170
yield from $this->gatherAssertTypes(__DIR__ . '/data/preg_split.php');

tests/PHPStan/Rules/Variables/data/bug-10577.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace Bug10577;
44

5+
use function PHPStan\Testing\assertType;
6+
57
class HelloWorld
68
{
79
private const MAP = [
@@ -20,6 +22,8 @@ public function validate(string $value): void
2022

2123
$value = self::MAP[$value] ?? $value;
2224

25+
assertType("'Test1'|'Test2'", self::MAP[$value]);
26+
2327
// ...
2428
}
2529
}

0 commit comments

Comments
 (0)