@@ -1069,7 +1069,7 @@ public function dataUnion(): iterable
1069
1069
new ObjectWithoutClassType (new ObjectType ('A ' )),
1070
1070
],
1071
1071
MixedType::class,
1072
- 'mixed=implicit ' ,
1072
+ 'mixed~int =implicit ' ,
1073
1073
],
1074
1074
[
1075
1075
[
@@ -1125,7 +1125,7 @@ public function dataUnion(): iterable
1125
1125
new ObjectType ('InvalidArgumentException ' ),
1126
1126
],
1127
1127
MixedType::class,
1128
- 'mixed=implicit ' , // should be MixedType~Exception+InvalidArgumentException
1128
+ 'mixed~Exception~InvalidArgumentException =implicit ' ,
1129
1129
],
1130
1130
[
1131
1131
[
@@ -2262,6 +2262,36 @@ public function dataUnion(): iterable
2262
2262
'PHPStan\Fixture\ManyCasesTestEnum~PHPStan\Fixture\ManyCasesTestEnum::A ' ,
2263
2263
];
2264
2264
2265
+ yield [
2266
+ [
2267
+ new ObjectType ('PHPStan\Fixture\ManyCasesTestEnum ' , new UnionType ([
2268
+ new EnumCaseObjectType ('PHPStan\Fixture\ManyCasesTestEnum ' , 'A ' ),
2269
+ new EnumCaseObjectType ('PHPStan\Fixture\ManyCasesTestEnum ' , 'B ' ),
2270
+ ])),
2271
+ new UnionType ([
2272
+ new EnumCaseObjectType ('PHPStan\Fixture\ManyCasesTestEnum ' , 'C ' ),
2273
+ new EnumCaseObjectType ('PHPStan\Fixture\ManyCasesTestEnum ' , 'D ' ),
2274
+ ]),
2275
+ ],
2276
+ ObjectType::class,
2277
+ 'PHPStan\Fixture\ManyCasesTestEnum~(PHPStan\Fixture\ManyCasesTestEnum::A|PHPStan\Fixture\ManyCasesTestEnum::B) ' ,
2278
+ ];
2279
+
2280
+ yield [
2281
+ [
2282
+ new ObjectType ('PHPStan\Fixture\ManyCasesTestEnum ' , new UnionType ([
2283
+ new EnumCaseObjectType ('PHPStan\Fixture\ManyCasesTestEnum ' , 'A ' ),
2284
+ new EnumCaseObjectType ('PHPStan\Fixture\ManyCasesTestEnum ' , 'B ' ),
2285
+ ])),
2286
+ new UnionType ([
2287
+ new EnumCaseObjectType ('PHPStan\Fixture\ManyCasesTestEnum ' , 'A ' ),
2288
+ new EnumCaseObjectType ('PHPStan\Fixture\ManyCasesTestEnum ' , 'D ' ),
2289
+ ]),
2290
+ ],
2291
+ ObjectType::class,
2292
+ 'PHPStan\Fixture\ManyCasesTestEnum~PHPStan\Fixture\ManyCasesTestEnum::B ' ,
2293
+ ];
2294
+
2265
2295
yield [
2266
2296
[
2267
2297
new ThisType (
@@ -4224,6 +4254,27 @@ public function dataIntersect(): iterable
4224
4254
'$this(stdClass)&stdClass::foo ' ,
4225
4255
];
4226
4256
4257
+ yield [
4258
+ [
4259
+ new EnumCaseObjectType ('PHPStan\Fixture\ManyCasesTestEnum ' , 'A ' ),
4260
+ new MixedType (false , new EnumCaseObjectType ('PHPStan\Fixture\ManyCasesTestEnum ' , 'A ' )),
4261
+ ],
4262
+ NeverType::class,
4263
+ '*NEVER*=implicit ' ,
4264
+ ];
4265
+
4266
+ yield [
4267
+ [
4268
+ new UnionType ([
4269
+ new EnumCaseObjectType ('PHPStan\Fixture\ManyCasesTestEnum ' , 'A ' ),
4270
+ new EnumCaseObjectType ('PHPStan\Fixture\ManyCasesTestEnum ' , 'B ' ),
4271
+ ]),
4272
+ new MixedType (false , new EnumCaseObjectType ('PHPStan\Fixture\ManyCasesTestEnum ' , 'A ' )),
4273
+ ],
4274
+ EnumCaseObjectType::class,
4275
+ 'PHPStan\Fixture\ManyCasesTestEnum::B ' ,
4276
+ ];
4277
+
4227
4278
yield [
4228
4279
[
4229
4280
TypeCombinator::intersect (new StringType (), new AccessoryNonEmptyStringType ()),
0 commit comments