File tree Expand file tree Collapse file tree 1 file changed +19
-9
lines changed
Expand file tree Collapse file tree 1 file changed +19
-9
lines changed Original file line number Diff line number Diff line change @@ -367,15 +367,6 @@ public function isSuperTypeOf(Type $type): TrinaryLogic
367367 return $ type ->isIterableAtLeastOnce ()->negate ();
368368 }
369369
370- if (
371- $ this ->isList ->yes ()
372- && $ type ->isList ->yes ()
373- && count ($ this ->keyTypes ) !== count ($ type ->keyTypes )
374- && count ($ type ->optionalKeys ) === 0
375- ) {
376- return TrinaryLogic::createNo ();
377- }
378-
379370 $ results = [];
380371 foreach ($ this ->keyTypes as $ i => $ keyType ) {
381372 $ hasOffset = $ type ->hasOffsetValueType ($ keyType );
@@ -397,6 +388,25 @@ public function isSuperTypeOf(Type $type): TrinaryLogic
397388 $ results [] = $ isValueSuperType ;
398389 }
399390
391+ if (
392+ $ this ->isList ->yes ()
393+ && $ type ->isList ->yes ()
394+ && count ($ this ->keyTypes ) !== count ($ type ->keyTypes )
395+ && count ($ type ->optionalKeys ) === 0
396+ ) {
397+ $ keepSeparate = true ;
398+ foreach ($ this ->valueTypes as $ valueType ) {
399+ if ($ valueType ->isConstantValue ()->yes ()) {
400+ $ keepSeparate = false ;
401+ break ;
402+ }
403+ }
404+
405+ if ($ keepSeparate ) {
406+ return TrinaryLogic::createNo ();
407+ }
408+ }
409+
400410 return TrinaryLogic::createYes ()->and (...$ results );
401411 }
402412
You can’t perform that action at this time.
0 commit comments