Skip to content

Commit 631138c

Browse files
phpstan-botclaude
andcommitted
Add isAcceptedBy test for array&hasOffsetValue with union accepting type
Tests that array<mixed>&hasOffsetValue(3, int) is accepted by array<int>|array<string> — the isSuperTypeOf guard correctly allows this since array<int> individually accepts the intersection. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 14d9af0 commit 631138c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

tests/PHPStan/Type/IntersectionTypeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ public static function dataIsAcceptedBy(): Iterator
209209
TrinaryLogic::createNo(),
210210
];
211211

212-
// array&hasOffsetValue(3, int) isAcceptedBy array<int>|array<string>
212+
// array&hasOffsetValue(3, int) isAcceptedBy array<int>|array<string> - yes (array<int> accepts it)
213213
yield [
214214
new IntersectionType([
215215
new ArrayType(new MixedType(), new MixedType()),

0 commit comments

Comments
 (0)