Skip to content

Commit 355d824

Browse files
Add tests
1 parent 9d88e75 commit 355d824

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

tests/PHPStan/Type/TypeCombinatorTest.php

Lines changed: 39 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,44 @@ 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+
isList: TrinaryLogic::createMaybe(),
4238+
),
4239+
new AccessoryArrayListType(),
4240+
],
4241+
ConstantArrayType::class,
4242+
'array{\'foo\', \'bar\'}',
4243+
],
4244+
[
4245+
[
4246+
new ConstantArrayType(
4247+
[new ConstantIntegerType(0), new ConstantIntegerType(1)],
4248+
[new ConstantStringType('foo'), new ConstantStringType('bar')],
4249+
[2],
4250+
[0, 1],
4251+
TrinaryLogic::createMaybe(),
4252+
),
4253+
new AccessoryArrayListType(),
4254+
],
4255+
ConstantArrayType::class,
4256+
'list{0?: \'foo\', 1?: \'bar\'}',
4257+
],
42194258
];
42204259

42214260
if (PHP_VERSION_ID < 80100) {

0 commit comments

Comments
 (0)