Code Modernization: Rename parameters that use reserved keywords in wp_die_*_handler filters.

While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.

This commit renames the `$function` parameter to `$callback` in `wp_die_*_handler` filters, which aims to make it easier to use a non-reserved parameter name for anyone utilizing these filters.

Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242].

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #55327.
Built from https://develop.svn.wordpress.org/trunk@53243


git-svn-id: http://core.svn.wordpress.org/trunk@52832 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2022-04-22 10:43:20 +00:00
parent 2bc70fc658
commit 752429a58e
2 changed files with 14 additions and 14 deletions

View File

@ -3656,36 +3656,36 @@ function wp_die( $message = '', $title = '', $args = array() ) {
*
* @since 3.4.0
*
* @param callable $function Callback function name.
* @param callable $callback Callback function name.
*/
$function = apply_filters( 'wp_die_ajax_handler', '_ajax_wp_die_handler' );
$callback = apply_filters( 'wp_die_ajax_handler', '_ajax_wp_die_handler' );
} elseif ( wp_is_json_request() ) {
/**
* Filters the callback for killing WordPress execution for JSON requests.
*
* @since 5.1.0
*
* @param callable $function Callback function name.
* @param callable $callback Callback function name.
*/
$function = apply_filters( 'wp_die_json_handler', '_json_wp_die_handler' );
$callback = apply_filters( 'wp_die_json_handler', '_json_wp_die_handler' );
} elseif ( defined( 'REST_REQUEST' ) && REST_REQUEST && wp_is_jsonp_request() ) {
/**
* Filters the callback for killing WordPress execution for JSONP REST requests.
*
* @since 5.2.0
*
* @param callable $function Callback function name.
* @param callable $callback Callback function name.
*/
$function = apply_filters( 'wp_die_jsonp_handler', '_jsonp_wp_die_handler' );
$callback = apply_filters( 'wp_die_jsonp_handler', '_jsonp_wp_die_handler' );
} elseif ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) {
/**
* Filters the callback for killing WordPress execution for XML-RPC requests.
*
* @since 3.4.0
*
* @param callable $function Callback function name.
* @param callable $callback Callback function name.
*/
$function = apply_filters( 'wp_die_xmlrpc_handler', '_xmlrpc_wp_die_handler' );
$callback = apply_filters( 'wp_die_xmlrpc_handler', '_xmlrpc_wp_die_handler' );
} elseif ( wp_is_xml_request()
|| isset( $wp_query ) &&
( function_exists( 'is_feed' ) && is_feed()
@ -3696,21 +3696,21 @@ function wp_die( $message = '', $title = '', $args = array() ) {
*
* @since 5.2.0
*
* @param callable $function Callback function name.
* @param callable $callback Callback function name.
*/
$function = apply_filters( 'wp_die_xml_handler', '_xml_wp_die_handler' );
$callback = apply_filters( 'wp_die_xml_handler', '_xml_wp_die_handler' );
} else {
/**
* Filters the callback for killing WordPress execution for all non-Ajax, non-JSON, non-XML requests.
*
* @since 3.0.0
*
* @param callable $function Callback function name.
* @param callable $callback Callback function name.
*/
$function = apply_filters( 'wp_die_handler', '_default_wp_die_handler' );
$callback = apply_filters( 'wp_die_handler', '_default_wp_die_handler' );
}
call_user_func( $function, $message, $title, $args );
call_user_func( $callback, $message, $title, $args );
}
/**

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.0-beta2-53242';
$wp_version = '6.0-beta2-53243';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.