Code Modernization: Rename parameters that use reserved keywords in `wp-includes/functions.wp-scripts.php`.
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 `$function_name` in `_wp_scripts_maybe_doing_it_wrong()`. * Renames the `$list` parameter to `$status` in `wp_script_is()`. 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], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277], [53281], [53283], [53284], [53285], [53287], [53364], [53365], [54927], [54929]. Props jrf, aristath, poena, justinahinon, SergeyBiryukov. See #56788. Built from https://develop.svn.wordpress.org/trunk@54930 git-svn-id: http://core.svn.wordpress.org/trunk@54482 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
a460de4e58
commit
2e6eb58946
|
@ -34,11 +34,11 @@ function wp_scripts() {
|
||||||
* @since 4.2.0
|
* @since 4.2.0
|
||||||
* @since 5.5.0 Added the `$handle` parameter.
|
* @since 5.5.0 Added the `$handle` parameter.
|
||||||
*
|
*
|
||||||
* @param string $function Function name.
|
* @param string $function_name Function name.
|
||||||
* @param string $handle Optional. Name of the script or stylesheet that was
|
* @param string $handle Optional. Name of the script or stylesheet that was
|
||||||
* registered or enqueued too early. Default empty.
|
* registered or enqueued too early. Default empty.
|
||||||
*/
|
*/
|
||||||
function _wp_scripts_maybe_doing_it_wrong( $function, $handle = '' ) {
|
function _wp_scripts_maybe_doing_it_wrong( $function_name, $handle = '' ) {
|
||||||
if ( did_action( 'init' ) || did_action( 'wp_enqueue_scripts' )
|
if ( did_action( 'init' ) || did_action( 'wp_enqueue_scripts' )
|
||||||
|| did_action( 'admin_enqueue_scripts' ) || did_action( 'login_enqueue_scripts' )
|
|| did_action( 'admin_enqueue_scripts' ) || did_action( 'login_enqueue_scripts' )
|
||||||
) {
|
) {
|
||||||
|
@ -62,7 +62,7 @@ function _wp_scripts_maybe_doing_it_wrong( $function, $handle = '' ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
_doing_it_wrong(
|
_doing_it_wrong(
|
||||||
$function,
|
$function_name,
|
||||||
$message,
|
$message,
|
||||||
'3.3.0'
|
'3.3.0'
|
||||||
);
|
);
|
||||||
|
@ -389,14 +389,14 @@ function wp_dequeue_script( $handle ) {
|
||||||
* @since 3.5.0 'enqueued' added as an alias of the 'queue' list.
|
* @since 3.5.0 'enqueued' added as an alias of the 'queue' list.
|
||||||
*
|
*
|
||||||
* @param string $handle Name of the script.
|
* @param string $handle Name of the script.
|
||||||
* @param string $list Optional. Status of the script to check. Default 'enqueued'.
|
* @param string $status Optional. Status of the script to check. Default 'enqueued'.
|
||||||
* Accepts 'enqueued', 'registered', 'queue', 'to_do', and 'done'.
|
* Accepts 'enqueued', 'registered', 'queue', 'to_do', and 'done'.
|
||||||
* @return bool Whether the script is queued.
|
* @return bool Whether the script is queued.
|
||||||
*/
|
*/
|
||||||
function wp_script_is( $handle, $list = 'enqueued' ) {
|
function wp_script_is( $handle, $status = 'enqueued' ) {
|
||||||
_wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle );
|
_wp_scripts_maybe_doing_it_wrong( __FUNCTION__, $handle );
|
||||||
|
|
||||||
return (bool) wp_scripts()->query( $handle, $list );
|
return (bool) wp_scripts()->query( $handle, $status );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.2-alpha-54929';
|
$wp_version = '6.2-alpha-54930';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue