From 127f188b44fd04bc0c51851db906887ddf98aade Mon Sep 17 00:00:00 2001 From: Dovid Levine Date: Tue, 19 Nov 2024 09:59:24 +0200 Subject: [PATCH] chore: Add explicit null return if docblocked --- src/wp-includes/compat.php | 3 +++ .../rest-api/endpoints/class-wp-rest-posts-controller.php | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/wp-includes/compat.php b/src/wp-includes/compat.php index 531c76fe1b2b3..3447d272a469e 100644 --- a/src/wp-includes/compat.php +++ b/src/wp-includes/compat.php @@ -418,6 +418,9 @@ function array_key_first( array $array ) { // phpcs:ignore Universal.NamingConve foreach ( $array as $key => $value ) { return $key; } + + // Return null for an empty array. + return null; } } diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php index c4db4871df644..8852519ec45c9 100644 --- a/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php +++ b/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php @@ -1649,6 +1649,8 @@ protected function handle_terms( $post_id, $request ) { return $result; } } + + return null; } /**