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
366
366
return $ type ->isIterableAtLeastOnce ()->negate ();
367
367
}
368
368
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
-
378
369
$ results = [];
379
370
foreach ($ this ->keyTypes as $ i => $ keyType ) {
380
371
$ hasOffset = $ type ->hasOffsetValueType ($ keyType );
@@ -396,6 +387,25 @@ public function isSuperTypeOf(Type $type): TrinaryLogic
396
387
$ results [] = $ isValueSuperType ;
397
388
}
398
389
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
+
399
409
return TrinaryLogic::createYes ()->and (...$ results );
400
410
}
401
411
You can’t perform that action at this time.
0 commit comments