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 @@ -366,15 +366,6 @@ public function isSuperTypeOf(Type $type): TrinaryLogic
366366 return $ type ->isIterableAtLeastOnce ()->negate ();
367367 }
368368
369- if (
370- $ this ->isList ->yes ()
371- && $ type ->isList ->yes ()
372- && count ($ this ->keyTypes ) !== count ($ type ->keyTypes )
373- && count ($ type ->optionalKeys ) === 0
374- ) {
375- return TrinaryLogic::createNo ();
376- }
377-
378369 $ results = [];
379370 foreach ($ this ->keyTypes as $ i => $ keyType ) {
380371 $ hasOffset = $ type ->hasOffsetValueType ($ keyType );
@@ -396,6 +387,25 @@ public function isSuperTypeOf(Type $type): TrinaryLogic
396387 $ results [] = $ isValueSuperType ;
397388 }
398389
390+ if (
391+ $ this ->isList ->yes ()
392+ && $ type ->isList ->yes ()
393+ && count ($ this ->keyTypes ) !== count ($ type ->keyTypes )
394+ && count ($ type ->optionalKeys ) === 0
395+ ) {
396+ $ keepSeparate = true ;
397+ foreach ($ this ->valueTypes as $ valueType ) {
398+ if ($ valueType ->isConstantValue ()->yes ()) {
399+ $ keepSeparate = false ;
400+ break ;
401+ }
402+ }
403+
404+ if ($ keepSeparate ) {
405+ return TrinaryLogic::createNo ();
406+ }
407+ }
408+
399409 return TrinaryLogic::createYes ()->and (...$ results );
400410 }
401411
You can’t perform that action at this time.
0 commit comments