Coding Standards: Explicitly return `null` instead of coercing `void`.
This addresses two instances where a function that is documented as returning `{someType}|null` doesn't explicitly return `null`. Affected functions: * `array_key_first()` * `WP_REST_Posts_Controller::handle_terms()` Follow-up to [38832], [52038]. Props justlevine. See #52217. Built from https://develop.svn.wordpress.org/trunk@59453 git-svn-id: http://core.svn.wordpress.org/trunk@58839 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
e80371660d
commit
7a78121aa0
|
@ -415,6 +415,10 @@ if ( ! function_exists( 'array_key_first' ) ) {
|
|||
* is not empty; `null` otherwise.
|
||||
*/
|
||||
function array_key_first( array $array ) { // phpcs:ignore Universal.NamingConventions.NoReservedKeywordParameterNames.arrayFound
|
||||
if ( empty( $array ) ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
foreach ( $array as $key => $value ) {
|
||||
return $key;
|
||||
}
|
||||
|
|
|
@ -1649,6 +1649,8 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
|
|||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.8-alpha-59452';
|
||||
$wp_version = '6.8-alpha-59453';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue