@@ -3139,14 +3139,23 @@ private function resolveNormalizedIdentical(Expr\BinaryOp\Identical $expr, Scope
31393139 $ unwrappedLeftExpr instanceof FuncCall
31403140 && $ unwrappedLeftExpr ->name instanceof Name
31413141 && !$ unwrappedLeftExpr ->isFirstClassCallable ()
3142- && in_array ($ unwrappedLeftExpr ->name ->toLowerString (), ['array_key_first ' , 'array_key_last ' , 'array_find_key ' ], true )
31433142 && isset ($ unwrappedLeftExpr ->getArgs ()[0 ])
31443143 && $ rightType ->isNull ()->yes ()
31453144 ) {
3146- $ args = $ unwrappedLeftExpr ->getArgs ();
3147- $ argType = $ scope ->getType ($ args [0 ]->value );
3148- if ($ argType ->isArray ()->yes ()) {
3149- return $ this ->create ($ args [0 ]->value , new NonEmptyArrayType (), $ context ->negate (), $ scope )->setRootExpr ($ expr );
3145+ $ funcName = $ unwrappedLeftExpr ->name ->toLowerString ();
3146+ $ bothDirections = in_array ($ funcName , ['array_key_first ' , 'array_key_last ' ], true );
3147+ $ notNullOnly = $ funcName === 'array_find_key ' ;
3148+ if ($ bothDirections || $ notNullOnly ) {
3149+ $ args = $ unwrappedLeftExpr ->getArgs ();
3150+ $ argType = $ scope ->getType ($ args [0 ]->value );
3151+ if ($ argType ->isArray ()->yes ()) {
3152+ if ($ bothDirections ) {
3153+ return $ this ->create ($ args [0 ]->value , new NonEmptyArrayType (), $ context ->negate (), $ scope )->setRootExpr ($ expr );
3154+ }
3155+ if ($ context ->falsey ()) {
3156+ return $ this ->create ($ args [0 ]->value , new NonEmptyArrayType (), $ context ->negate (), $ scope )->setRootExpr ($ expr );
3157+ }
3158+ }
31503159 }
31513160 }
31523161
0 commit comments