@@ -108,4 +108,22 @@ public function countListRecursive($list): void
108108 assertType ('int<3, max> ' , count ($ list , COUNT_RECURSIVE ));
109109 }
110110 }
111+
112+ public function countConstantArray (array $ anotherArray ): void {
113+ $ arr = [1 , 2 , 3 , [4 , 5 ]];
114+ assertType ('4 ' , count ($ arr ));
115+ assertType ('4 ' , count ($ arr , COUNT_NORMAL ));
116+ assertType ('int<1, max> ' , count ($ arr , COUNT_RECURSIVE ));
117+
118+ $ arr = [1 , 2 , 3 , $ anotherArray ];
119+ assertType ('4 ' , count ($ arr ));
120+ assertType ('4 ' , count ($ arr , COUNT_NORMAL ));
121+ assertType ('int<1, max> ' , count ($ arr , COUNT_RECURSIVE )); // could be int<4, max>
122+
123+ $ arr = [1 , 2 , 3 ] + $ anotherArray ;
124+ assertType ('non-empty-array&hasOffsetValue(0, 1)&hasOffsetValue(1, 2)&hasOffsetValue(2, 3) ' , $ arr );
125+ assertType ('int<1, max> ' , count ($ arr )); // could be int<3, max>
126+ assertType ('int<1, max> ' , count ($ arr , COUNT_NORMAL )); // could be int<3, max>
127+ assertType ('int<1, max> ' , count ($ arr , COUNT_RECURSIVE ));
128+ }
111129}
0 commit comments