Skip to content

Commit 4e14478

Browse files
Add tests
1 parent 9d88e75 commit 4e14478

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

tests/PHPStan/Type/TypeCombinatorTest.php

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use PHPStan\Reflection\Callables\SimpleImpurePoint;
2020
use PHPStan\Testing\PHPStanTestCase;
2121
use PHPStan\TrinaryLogic;
22+
use PHPStan\Type\Accessory\AccessoryArrayListType;
2223
use PHPStan\Type\Accessory\AccessoryLiteralStringType;
2324
use PHPStan\Type\Accessory\AccessoryLowercaseStringType;
2425
use PHPStan\Type\Accessory\AccessoryNonEmptyStringType;
@@ -4216,6 +4217,45 @@ public static function dataIntersect(): iterable
42164217
StringType::class,
42174218
'string',
42184219
],
4220+
[
4221+
[
4222+
new ConstantArrayType(
4223+
[new ConstantStringType('a')],
4224+
[new ConstantStringType('foo')],
4225+
),
4226+
new AccessoryArrayListType(),
4227+
],
4228+
NeverType::class,
4229+
'*NEVER*=implicit',
4230+
],
4231+
[
4232+
[
4233+
new ConstantArrayType(
4234+
[new ConstantIntegerType(0), new ConstantIntegerType(1)],
4235+
[new ConstantStringType('foo'), new ConstantStringType('bar')],
4236+
[2],
4237+
[],
4238+
TrinaryLogic::createMaybe(),
4239+
),
4240+
new AccessoryArrayListType(),
4241+
],
4242+
ConstantArrayType::class,
4243+
'array{\'foo\', \'bar\'}',
4244+
],
4245+
[
4246+
[
4247+
new ConstantArrayType(
4248+
[new ConstantIntegerType(0), new ConstantIntegerType(1)],
4249+
[new ConstantStringType('foo'), new ConstantStringType('bar')],
4250+
[2],
4251+
[0, 1],
4252+
TrinaryLogic::createMaybe(),
4253+
),
4254+
new AccessoryArrayListType(),
4255+
],
4256+
ConstantArrayType::class,
4257+
'list{0?: \'foo\', 1?: \'bar\'}',
4258+
],
42194259
];
42204260

42214261
if (PHP_VERSION_ID < 80100) {

0 commit comments

Comments
 (0)