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