Skip to content

Commit 14d9af0

Browse files
phpstan-botclaude
andcommitted
Add isAcceptedBy test for array&hasOffsetValue against union type array<int>|array<string>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 507d88a commit 14d9af0

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

tests/PHPStan/Type/IntersectionTypeTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,20 @@ public static function dataIsAcceptedBy(): Iterator
208208
),
209209
TrinaryLogic::createNo(),
210210
];
211+
212+
// array&hasOffsetValue(3, int) isAcceptedBy array<int>|array<string>
213+
yield [
214+
new IntersectionType([
215+
new ArrayType(new MixedType(), new MixedType()),
216+
new NonEmptyArrayType(),
217+
new HasOffsetValueType(new ConstantIntegerType(3), new IntegerType()),
218+
]),
219+
new UnionType([
220+
new ArrayType(new MixedType(), new IntegerType()),
221+
new ArrayType(new MixedType(), new StringType()),
222+
]),
223+
TrinaryLogic::createYes(),
224+
];
211225
}
212226

213227
#[DataProvider('dataIsAcceptedBy')]

0 commit comments

Comments
 (0)