Commit ed6bc0b 1 parent 6321600 commit ed6bc0b Copy full SHA for ed6bc0b
File tree 2 files changed +51
-8
lines changed
2 files changed +51
-8
lines changed Original file line number Diff line number Diff line change @@ -364,14 +364,7 @@ public function isSuperTypeOf(Type $type): TrinaryLogic
364
364
{
365
365
if ($ type instanceof self) {
366
366
if (count ($ this ->keyTypes ) === 0 ) {
367
- if (count ($ type ->keyTypes ) > 0 ) {
368
- if (count ($ type ->optionalKeys ) > 0 ) {
369
- return TrinaryLogic::createMaybe ();
370
- }
371
- return TrinaryLogic::createNo ();
372
- }
373
-
374
- return TrinaryLogic::createYes ();
367
+ return $ type ->isIterableAtLeastOnce ()->negate ();
375
368
}
376
369
377
370
$ results = [];
Original file line number Diff line number Diff line change @@ -4252,6 +4252,56 @@ public function dataIntersect(): iterable
4252
4252
ClosureType::class,
4253
4253
'pure-Closure ' ,
4254
4254
];
4255
+
4256
+ $ xy = new ConstantArrayType ([
4257
+ new ConstantIntegerType (0 ),
4258
+ ], [
4259
+ new ConstantStringType ('xy ' ),
4260
+ ]);
4261
+ $ abxy = new ConstantArrayType ([
4262
+ new ConstantIntegerType (0 ),
4263
+ new ConstantIntegerType (1 ),
4264
+ ], [
4265
+ new ConstantStringType ('ab ' ),
4266
+ new ConstantStringType ('xy ' ),
4267
+ ], [2 ], [1 ]);
4268
+
4269
+ yield [
4270
+ [
4271
+ new UnionType ([
4272
+ new ConstantArrayType ([], []),
4273
+ $ xy ,
4274
+ $ abxy ,
4275
+ ]),
4276
+ new UnionType ([
4277
+ $ xy ,
4278
+ $ abxy ,
4279
+ ]),
4280
+ ],
4281
+ UnionType::class,
4282
+ "array{'xy'}|array{0: 'ab', 1?: 'xy'} " ,
4283
+ ];
4284
+
4285
+ yield [
4286
+ [
4287
+ new ConstantArrayType ([], []),
4288
+ new UnionType ([
4289
+ $ xy ,
4290
+ $ abxy ,
4291
+ ]),
4292
+ ],
4293
+ NeverType::class,
4294
+ '*NEVER*=implicit ' ,
4295
+ ];
4296
+
4297
+ yield [
4298
+ [
4299
+ new ConstantArrayType ([], []),
4300
+ $ abxy ,
4301
+ ],
4302
+ NeverType::class,
4303
+ '*NEVER*=implicit ' ,
4304
+ ];
4255
4305
}
4256
4306
4257
4307
/**
You can’t perform that action at this time.
0 commit comments