@@ -2280,14 +2280,23 @@ public function resolveIdentical(Expr\BinaryOp\Identical $expr, Scope $scope, Ty
22802280 $ leftArrayType = $ scope ->getType ($ unwrappedLeftExpr ->getArgs ()[0 ]->value );
22812281 $ rightArrayType = $ scope ->getType ($ unwrappedRightExpr ->getArgs ()[0 ]->value );
22822282
2283- if (
2284- $ leftArrayType ->isArray ()->yes () && $ rightArrayType ->isArray ()->yes ()
2285- && ($ leftArrayType ->isIterableAtLeastOnce ()->yes () || $ rightArrayType ->isIterableAtLeastOnce ()->yes ())
2286- ) {
2287- $ arrayTypes = $ this ->create ($ unwrappedLeftExpr ->getArgs ()[0 ]->value , new NonEmptyArrayType (), $ context , $ scope )->setRootExpr ($ expr );
2288- return $ arrayTypes ->unionWith (
2289- $ this ->create ($ unwrappedRightExpr ->getArgs ()[0 ]->value , new NonEmptyArrayType (), $ context , $ scope )->setRootExpr ($ expr ),
2290- );
2283+ if ($ leftArrayType ->isArray ()->yes () && $ rightArrayType ->isArray ()->yes ()) {
2284+ $ argType = $ scope ->getType ($ unwrappedRightExpr ->getArgs ()[0 ]->value );
2285+ $ sizeType = $ scope ->getType ($ leftExpr );
2286+
2287+ if ($ sizeType instanceof IntegerRangeType || $ sizeType ->isConstantScalarValue ()->yes ()) {
2288+ $ specifiedTypes = $ this ->specifyTypesForCountFuncCall ($ unwrappedRightExpr , $ argType , $ sizeType , $ context , $ scope , $ expr );
2289+ if ($ specifiedTypes !== null ) {
2290+ return $ specifiedTypes ;
2291+ }
2292+ }
2293+
2294+ if ($ leftArrayType ->isIterableAtLeastOnce ()->yes () || $ rightArrayType ->isIterableAtLeastOnce ()->yes ()) {
2295+ $ arrayTypes = $ this ->create ($ unwrappedLeftExpr ->getArgs ()[0 ]->value , new NonEmptyArrayType (), $ context , $ scope )->setRootExpr ($ expr );
2296+ return $ arrayTypes ->unionWith (
2297+ $ this ->create ($ unwrappedRightExpr ->getArgs ()[0 ]->value , new NonEmptyArrayType (), $ context , $ scope )->setRootExpr ($ expr ),
2298+ );
2299+ }
22912300 }
22922301 }
22932302
0 commit comments