File tree Expand file tree Collapse file tree 2 files changed +51
-8
lines changed
Expand file tree Collapse file tree 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
364364 {
365365 if ($ type instanceof self) {
366366 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 ();
375368 }
376369
377370 $ results = [];
Original file line number Diff line number Diff line change @@ -4252,6 +4252,56 @@ public function dataIntersect(): iterable
42524252 ClosureType::class,
42534253 'pure-Closure ' ,
42544254 ];
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+ ];
42554305 }
42564306
42574307 /**
You can’t perform that action at this time.
0 commit comments