@@ -2263,14 +2263,23 @@ public function resolveIdentical(Expr\BinaryOp\Identical $expr, Scope $scope, Ty
22632263 $ leftArrayType = $ scope ->getType ($ unwrappedLeftExpr ->getArgs ()[0 ]->value );
22642264 $ rightArrayType = $ scope ->getType ($ unwrappedRightExpr ->getArgs ()[0 ]->value );
22652265
2266- if (
2267- $ leftArrayType ->isArray ()->yes () && $ rightArrayType ->isArray ()->yes ()
2268- && ($ leftArrayType ->isIterableAtLeastOnce ()->yes () || $ rightArrayType ->isIterableAtLeastOnce ()->yes ())
2269- ) {
2270- $ arrayTypes = $ this ->create ($ unwrappedLeftExpr ->getArgs ()[0 ]->value , new NonEmptyArrayType (), $ context , $ scope )->setRootExpr ($ expr );
2271- return $ arrayTypes ->unionWith (
2272- $ this ->create ($ unwrappedRightExpr ->getArgs ()[0 ]->value , new NonEmptyArrayType (), $ context , $ scope )->setRootExpr ($ expr ),
2273- );
2266+ if ($ leftArrayType ->isArray ()->yes () && $ rightArrayType ->isArray ()->yes ()) {
2267+ $ argType = $ scope ->getType ($ unwrappedRightExpr ->getArgs ()[0 ]->value );
2268+ $ sizeType = $ scope ->getType ($ leftExpr );
2269+
2270+ if ($ sizeType instanceof IntegerRangeType || $ sizeType ->isConstantScalarValue ()->yes ()) {
2271+ $ specifiedTypes = $ this ->specifyTypesForCountFuncCall ($ unwrappedRightExpr , $ argType , $ sizeType , $ context , $ scope , $ expr );
2272+ if ($ specifiedTypes !== null ) {
2273+ return $ specifiedTypes ;
2274+ }
2275+ }
2276+
2277+ if ($ leftArrayType ->isIterableAtLeastOnce ()->yes () || $ rightArrayType ->isIterableAtLeastOnce ()->yes ()) {
2278+ $ arrayTypes = $ this ->create ($ unwrappedLeftExpr ->getArgs ()[0 ]->value , new NonEmptyArrayType (), $ context , $ scope )->setRootExpr ($ expr );
2279+ return $ arrayTypes ->unionWith (
2280+ $ this ->create ($ unwrappedRightExpr ->getArgs ()[0 ]->value , new NonEmptyArrayType (), $ context , $ scope )->setRootExpr ($ expr ),
2281+ );
2282+ }
22742283 }
22752284 }
22762285
0 commit comments