@@ -2260,28 +2260,26 @@ public function resolveIdentical(Expr\BinaryOp\Identical $expr, Scope $scope, Ty
22602260 && in_array ($ unwrappedRightExpr ->name ->toLowerString (), ['count ' , 'sizeof ' ], true )
22612261 && count ($ unwrappedRightExpr ->getArgs ()) >= 1
22622262 ) {
2263- $ leftArrayType = $ scope ->getType ($ unwrappedLeftExpr ->getArgs ()[0 ]->value );
2264- $ rightArrayType = $ scope ->getType ($ unwrappedRightExpr -> getArgs ()[ 0 ]-> value );
2263+ $ argType = $ scope ->getType ($ unwrappedRightExpr ->getArgs ()[0 ]->value );
2264+ $ sizeType = $ scope ->getType ($ leftExpr );
22652265
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- }
2266+ $ specifiedTypes = $ this ->specifyTypesForCountFuncCall ($ unwrappedRightExpr , $ argType , $ sizeType , $ context , $ scope , $ expr );
2267+ if ($ specifiedTypes !== null ) {
2268+ return $ specifiedTypes ;
2269+ }
22762270
2277- if (!$ rightType ->isConstantScalarValue ()->yes ()) {
2278- if ($ leftArrayType ->isIterableAtLeastOnce ()->yes () || $ rightArrayType ->isIterableAtLeastOnce ()->yes ()) {
2279- $ arrayTypes = $ this ->create ($ unwrappedLeftExpr ->getArgs ()[0 ]->value , new NonEmptyArrayType (), $ context , $ scope )->setRootExpr ($ expr );
2280- return $ arrayTypes ->unionWith (
2281- $ this ->create ($ unwrappedRightExpr ->getArgs ()[0 ]->value , new NonEmptyArrayType (), $ context , $ scope )->setRootExpr ($ expr ),
2282- );
2283- }
2284- }
2271+ $ leftArrayType = $ scope ->getType ($ unwrappedLeftExpr ->getArgs ()[0 ]->value );
2272+ $ rightArrayType = $ scope ->getType ($ unwrappedRightExpr ->getArgs ()[0 ]->value );
2273+ if (
2274+ $ leftArrayType ->isArray ()->yes ()
2275+ && $ rightArrayType ->isArray ()->yes ()
2276+ && !$ rightType ->isConstantScalarValue ()->yes ()
2277+ && ($ leftArrayType ->isIterableAtLeastOnce ()->yes () || $ rightArrayType ->isIterableAtLeastOnce ()->yes ())
2278+ ) {
2279+ $ arrayTypes = $ this ->create ($ unwrappedLeftExpr ->getArgs ()[0 ]->value , new NonEmptyArrayType (), $ context , $ scope )->setRootExpr ($ expr );
2280+ return $ arrayTypes ->unionWith (
2281+ $ this ->create ($ unwrappedRightExpr ->getArgs ()[0 ]->value , new NonEmptyArrayType (), $ context , $ scope )->setRootExpr ($ expr ),
2282+ );
22852283 }
22862284 }
22872285
0 commit comments