File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -458,14 +458,24 @@ public function getOffsetValueType(Type $offsetType): Type
458
458
{
459
459
$ offsetType = ArrayType::castToArrayKeyType ($ offsetType );
460
460
$ matchingValueTypes = [];
461
+ $ all = true ;
461
462
foreach ($ this ->keyTypes as $ i => $ keyType ) {
462
463
if ($ keyType ->isSuperTypeOf ($ offsetType )->no ()) {
464
+ $ all = false ;
463
465
continue ;
464
466
}
465
467
466
468
$ matchingValueTypes [] = $ this ->valueTypes [$ i ];
467
469
}
468
470
471
+ if ($ all ) {
472
+ if (count ($ this ->keyTypes ) === 0 ) {
473
+ return new ErrorType ();
474
+ }
475
+
476
+ return $ this ->getIterableValueType ();
477
+ }
478
+
469
479
if (count ($ matchingValueTypes ) > 0 ) {
470
480
$ type = TypeCombinator::union (...$ matchingValueTypes );
471
481
if ($ type instanceof ErrorType) {
You can’t perform that action at this time.
0 commit comments