@@ -1087,10 +1087,7 @@ private function specifyTypesForCountFuncCall(
1087
1087
if (
1088
1088
$ sizeType instanceof ConstantIntegerType
1089
1089
&& $ sizeType ->getValue () < ConstantArrayTypeBuilder::ARRAY_COUNT_LIMIT
1090
- && (
1091
- $ isList ->yes ()
1092
- || $ isConstantArray ->yes () && $ arrayType ->getKeyType ()->isSuperTypeOf (IntegerRangeType::fromInterval (0 , $ sizeType ->getValue () - 1 ))->yes ()
1093
- )
1090
+ && $ arrayType ->getKeyType ()->isSuperTypeOf (IntegerRangeType::fromInterval (0 , $ sizeType ->getValue () - 1 ))->yes ()
1094
1091
) {
1095
1092
// turn optional offsets non-optional
1096
1093
$ valueTypesBuilder = ConstantArrayTypeBuilder::createEmpty ();
@@ -1107,28 +1104,18 @@ private function specifyTypesForCountFuncCall(
1107
1104
&& $ sizeType ->getMin () !== null
1108
1105
&& $ sizeType ->getMin () <= ConstantArrayTypeBuilder::ARRAY_COUNT_LIMIT
1109
1106
&& ($ sizeType ->getMax () === null || $ sizeType ->getMax () - $ sizeType ->getMin () <= ConstantArrayTypeBuilder::ARRAY_COUNT_LIMIT )
1110
- && (
1111
- $ isList ->yes ()
1112
- || $ isConstantArray ->yes () && $ arrayType ->getKeyType ()->isSuperTypeOf (IntegerRangeType::fromInterval (0 , $ sizeType ->getMin () - 1 ))->yes ()
1113
- )
1107
+ && $ arrayType ->getKeyType ()->isSuperTypeOf (IntegerRangeType::fromInterval (0 , $ sizeType ->getMin () - 1 ))->yes ()
1108
+ && ($ sizeType ->getMax () === null || $ arrayType ->getKeyType ()->isSuperTypeOf (IntegerRangeType::fromInterval (0 , $ sizeType ->getMax () - 1 ))->yes ())
1114
1109
) {
1115
1110
// turn optional offsets non-optional
1116
1111
$ valueTypesBuilder = ConstantArrayTypeBuilder::createEmpty ();
1117
1112
for ($ i = 0 ; $ i < $ sizeType ->getMin (); $ i ++) {
1118
1113
$ offsetType = new ConstantIntegerType ($ i );
1119
- $ hasOffset = $ arrayType ->hasOffsetValueType ($ offsetType );
1120
- if ($ hasOffset ->no ()) {
1121
- break ;
1122
- }
1123
1114
$ valueTypesBuilder ->setOffsetValueType ($ offsetType , $ arrayType ->getOffsetValueType ($ offsetType ));
1124
1115
}
1125
1116
if ($ sizeType ->getMax () !== null ) {
1126
1117
for ($ i = $ sizeType ->getMin (); $ i < $ sizeType ->getMax (); $ i ++) {
1127
1118
$ offsetType = new ConstantIntegerType ($ i );
1128
- $ hasOffset = $ arrayType ->hasOffsetValueType ($ offsetType );
1129
- if ($ hasOffset ->no ()) {
1130
- break ;
1131
- }
1132
1119
$ valueTypesBuilder ->setOffsetValueType ($ offsetType , $ arrayType ->getOffsetValueType ($ offsetType ), true );
1133
1120
}
1134
1121
} elseif ($ arrayType ->isConstantArray ()->yes ()) {
0 commit comments