Skip to content

Commit 10d9600

Browse files
committed
So intersecting of constant arrays works
1 parent 8413b00 commit 10d9600

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

tests/PHPStan/Type/TypeCombinatorTest.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5083,6 +5083,27 @@ public static function dataIntersect(): iterable
50835083
ConstantArrayType::class,
50845084
'array{0|1|2|3, stdClass}',
50855085
];
5086+
5087+
yield [
5088+
[
5089+
new ConstantArrayType(
5090+
[new ConstantIntegerType(0), new ConstantIntegerType(1)],
5091+
[new IntegerType(), new UnionType([
5092+
new ConstantStringType('0'),
5093+
new ConstantStringType('foo'),
5094+
])]
5095+
),
5096+
new ConstantArrayType(
5097+
[new ConstantIntegerType(0), new ConstantIntegerType(1)],
5098+
[IntegerRangeType::createAllGreaterThanOrEqualTo(0), new IntersectionType([
5099+
new StringType(),
5100+
new AccessoryNonFalsyStringType(),
5101+
])],
5102+
),
5103+
],
5104+
ConstantArrayType::class,
5105+
"array{int<0, max>, 'foo'}",
5106+
];
50865107
}
50875108

50885109
/**

0 commit comments

Comments
 (0)