@@ -1087,10 +1087,7 @@ private function specifyTypesForCountFuncCall(
10871087 if (
10881088 $ sizeType instanceof ConstantIntegerType
10891089 && $ 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 ()
10941091 ) {
10951092 // turn optional offsets non-optional
10961093 $ valueTypesBuilder = ConstantArrayTypeBuilder::createEmpty ();
@@ -1107,28 +1104,18 @@ private function specifyTypesForCountFuncCall(
11071104 && $ sizeType ->getMin () !== null
11081105 && $ sizeType ->getMin () <= ConstantArrayTypeBuilder::ARRAY_COUNT_LIMIT
11091106 && ($ 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 ())
11141109 ) {
11151110 // turn optional offsets non-optional
11161111 $ valueTypesBuilder = ConstantArrayTypeBuilder::createEmpty ();
11171112 for ($ i = 0 ; $ i < $ sizeType ->getMin (); $ i ++) {
11181113 $ offsetType = new ConstantIntegerType ($ i );
1119- $ hasOffset = $ arrayType ->hasOffsetValueType ($ offsetType );
1120- if ($ hasOffset ->no ()) {
1121- break ;
1122- }
11231114 $ valueTypesBuilder ->setOffsetValueType ($ offsetType , $ arrayType ->getOffsetValueType ($ offsetType ));
11241115 }
11251116 if ($ sizeType ->getMax () !== null ) {
11261117 for ($ i = $ sizeType ->getMin (); $ i < $ sizeType ->getMax (); $ i ++) {
11271118 $ offsetType = new ConstantIntegerType ($ i );
1128- $ hasOffset = $ arrayType ->hasOffsetValueType ($ offsetType );
1129- if ($ hasOffset ->no ()) {
1130- break ;
1131- }
11321119 $ valueTypesBuilder ->setOffsetValueType ($ offsetType , $ arrayType ->getOffsetValueType ($ offsetType ), true );
11331120 }
11341121 } elseif ($ arrayType ->isConstantArray ()->yes ()) {
0 commit comments