Plugins: Consistently use an empty string as the default value for `$replacement` and `$message` parameters in:
* `_deprecated_function()` * `_deprecated_constructor()` * `_deprecated_file()` * `_deprecated_argument()` * `_deprecated_hook()` * `apply_filters_deprecated()` * `do_action_deprecated()` This matches the documented type of `string` for these parameters and removes unnecessarily strict `! is_null()` checks. Follow-up to [46792]. Props jignesh.nakrani, renathoc, SergeyBiryukov. Fixes #49698. Built from https://develop.svn.wordpress.org/trunk@48327 git-svn-id: http://core.svn.wordpress.org/trunk@48096 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
87f464c283
commit
69e7e7681b
|
@ -4700,9 +4700,9 @@ function absint( $maybeint ) {
|
|||
*
|
||||
* @param string $function The function that was called.
|
||||
* @param string $version The version of WordPress that deprecated the function.
|
||||
* @param string $replacement Optional. The function that should have been called. Default null.
|
||||
* @param string $replacement Optional. The function that should have been called. Default empty.
|
||||
*/
|
||||
function _deprecated_function( $function, $version, $replacement = null ) {
|
||||
function _deprecated_function( $function, $version, $replacement = '' ) {
|
||||
|
||||
/**
|
||||
* Fires when a deprecated function is called.
|
||||
|
@ -4724,7 +4724,7 @@ function _deprecated_function( $function, $version, $replacement = null ) {
|
|||
*/
|
||||
if ( WP_DEBUG && apply_filters( 'deprecated_function_trigger_error', true ) ) {
|
||||
if ( function_exists( '__' ) ) {
|
||||
if ( ! is_null( $replacement ) ) {
|
||||
if ( $replacement ) {
|
||||
trigger_error(
|
||||
sprintf(
|
||||
/* translators: 1: PHP function name, 2: Version number, 3: Alternative function name. */
|
||||
|
@ -4747,7 +4747,7 @@ function _deprecated_function( $function, $version, $replacement = null ) {
|
|||
);
|
||||
}
|
||||
} else {
|
||||
if ( ! is_null( $replacement ) ) {
|
||||
if ( $replacement ) {
|
||||
trigger_error(
|
||||
sprintf(
|
||||
'%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.',
|
||||
|
@ -4816,7 +4816,7 @@ function _deprecated_constructor( $class, $version, $parent_class = '' ) {
|
|||
*/
|
||||
if ( WP_DEBUG && apply_filters( 'deprecated_constructor_trigger_error', true ) ) {
|
||||
if ( function_exists( '__' ) ) {
|
||||
if ( ! empty( $parent_class ) ) {
|
||||
if ( $parent_class ) {
|
||||
trigger_error(
|
||||
sprintf(
|
||||
/* translators: 1: PHP class name, 2: PHP parent class name, 3: Version number, 4: __construct() method. */
|
||||
|
@ -4841,7 +4841,7 @@ function _deprecated_constructor( $class, $version, $parent_class = '' ) {
|
|||
);
|
||||
}
|
||||
} else {
|
||||
if ( ! empty( $parent_class ) ) {
|
||||
if ( $parent_class ) {
|
||||
trigger_error(
|
||||
sprintf(
|
||||
'The called constructor method for %1$s in %2$s is <strong>deprecated</strong> since version %3$s! Use %4$s instead.',
|
||||
|
@ -4886,10 +4886,10 @@ function _deprecated_constructor( $class, $version, $parent_class = '' ) {
|
|||
* @param string $file The file that was included.
|
||||
* @param string $version The version of WordPress that deprecated the file.
|
||||
* @param string $replacement Optional. The file that should have been included based on ABSPATH.
|
||||
* Default null.
|
||||
* Default empty.
|
||||
* @param string $message Optional. A message regarding the change. Default empty.
|
||||
*/
|
||||
function _deprecated_file( $file, $version, $replacement = null, $message = '' ) {
|
||||
function _deprecated_file( $file, $version, $replacement = '', $message = '' ) {
|
||||
|
||||
/**
|
||||
* Fires when a deprecated file is called.
|
||||
|
@ -4914,7 +4914,7 @@ function _deprecated_file( $file, $version, $replacement = null, $message = '' )
|
|||
$message = empty( $message ) ? '' : ' ' . $message;
|
||||
|
||||
if ( function_exists( '__' ) ) {
|
||||
if ( ! is_null( $replacement ) ) {
|
||||
if ( $replacement ) {
|
||||
trigger_error(
|
||||
sprintf(
|
||||
/* translators: 1: PHP file name, 2: Version number, 3: Alternative file name. */
|
||||
|
@ -4937,7 +4937,7 @@ function _deprecated_file( $file, $version, $replacement = null, $message = '' )
|
|||
);
|
||||
}
|
||||
} else {
|
||||
if ( ! is_null( $replacement ) ) {
|
||||
if ( $replacement ) {
|
||||
trigger_error(
|
||||
sprintf(
|
||||
'%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.',
|
||||
|
@ -4984,9 +4984,9 @@ function _deprecated_file( $file, $version, $replacement = null, $message = '' )
|
|||
*
|
||||
* @param string $function The function that was called.
|
||||
* @param string $version The version of WordPress that deprecated the argument used.
|
||||
* @param string $message Optional. A message regarding the change. Default null.
|
||||
* @param string $message Optional. A message regarding the change. Default empty.
|
||||
*/
|
||||
function _deprecated_argument( $function, $version, $message = null ) {
|
||||
function _deprecated_argument( $function, $version, $message = '' ) {
|
||||
|
||||
/**
|
||||
* Fires when a deprecated argument is called.
|
||||
|
@ -5008,7 +5008,7 @@ function _deprecated_argument( $function, $version, $message = null ) {
|
|||
*/
|
||||
if ( WP_DEBUG && apply_filters( 'deprecated_argument_trigger_error', true ) ) {
|
||||
if ( function_exists( '__' ) ) {
|
||||
if ( ! is_null( $message ) ) {
|
||||
if ( $message ) {
|
||||
trigger_error(
|
||||
sprintf(
|
||||
/* translators: 1: PHP function name, 2: Version number, 3: Optional message regarding the change. */
|
||||
|
@ -5031,7 +5031,7 @@ function _deprecated_argument( $function, $version, $message = null ) {
|
|||
);
|
||||
}
|
||||
} else {
|
||||
if ( ! is_null( $message ) ) {
|
||||
if ( $message ) {
|
||||
trigger_error(
|
||||
sprintf(
|
||||
'%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s',
|
||||
|
@ -5072,10 +5072,10 @@ function _deprecated_argument( $function, $version, $message = null ) {
|
|||
*
|
||||
* @param string $hook The hook that was used.
|
||||
* @param string $version The version of WordPress that deprecated the hook.
|
||||
* @param string $replacement Optional. The hook that should have been used. Default null.
|
||||
* @param string $message Optional. A message regarding the change. Default null.
|
||||
* @param string $replacement Optional. The hook that should have been used. Default empty.
|
||||
* @param string $message Optional. A message regarding the change. Default empty.
|
||||
*/
|
||||
function _deprecated_hook( $hook, $version, $replacement = null, $message = null ) {
|
||||
function _deprecated_hook( $hook, $version, $replacement = '', $message = '' ) {
|
||||
/**
|
||||
* Fires when a deprecated hook is called.
|
||||
*
|
||||
|
@ -5099,7 +5099,7 @@ function _deprecated_hook( $hook, $version, $replacement = null, $message = null
|
|||
if ( WP_DEBUG && apply_filters( 'deprecated_hook_trigger_error', true ) ) {
|
||||
$message = empty( $message ) ? '' : ' ' . $message;
|
||||
|
||||
if ( ! is_null( $replacement ) ) {
|
||||
if ( $replacement ) {
|
||||
trigger_error(
|
||||
sprintf(
|
||||
/* translators: 1: WordPress hook name, 2: Version number, 3: Alternative hook name. */
|
||||
|
@ -5166,9 +5166,7 @@ function _doing_it_wrong( $function, $message, $version ) {
|
|||
*/
|
||||
if ( WP_DEBUG && apply_filters( 'doing_it_wrong_trigger_error', true, $function, $message, $version ) ) {
|
||||
if ( function_exists( '__' ) ) {
|
||||
if ( is_null( $version ) ) {
|
||||
$version = '';
|
||||
} else {
|
||||
if ( $version ) {
|
||||
/* translators: %s: Version number. */
|
||||
$version = sprintf( __( '(This message was added in version %s.)' ), $version );
|
||||
}
|
||||
|
@ -5190,9 +5188,7 @@ function _doing_it_wrong( $function, $message, $version ) {
|
|||
E_USER_NOTICE
|
||||
);
|
||||
} else {
|
||||
if ( is_null( $version ) ) {
|
||||
$version = '';
|
||||
} else {
|
||||
if ( $version ) {
|
||||
$version = sprintf( '(This message was added in version %s.)', $version );
|
||||
}
|
||||
|
||||
|
|
|
@ -620,10 +620,10 @@ function remove_all_actions( $tag, $priority = false ) {
|
|||
* @param string $tag The name of the filter hook.
|
||||
* @param array $args Array of additional function arguments to be passed to apply_filters().
|
||||
* @param string $version The version of WordPress that deprecated the hook.
|
||||
* @param string $replacement Optional. The hook that should have been used. Default null.
|
||||
* @param string $message Optional. A message regarding the change. Default null.
|
||||
* @param string $replacement Optional. The hook that should have been used. Default empty.
|
||||
* @param string $message Optional. A message regarding the change. Default empty.
|
||||
*/
|
||||
function apply_filters_deprecated( $tag, $args, $version, $replacement = null, $message = null ) {
|
||||
function apply_filters_deprecated( $tag, $args, $version, $replacement = '', $message = '' ) {
|
||||
if ( ! has_filter( $tag ) ) {
|
||||
return $args[0];
|
||||
}
|
||||
|
@ -647,10 +647,10 @@ function apply_filters_deprecated( $tag, $args, $version, $replacement = null, $
|
|||
* @param string $tag The name of the action hook.
|
||||
* @param array $args Array of additional function arguments to be passed to do_action().
|
||||
* @param string $version The version of WordPress that deprecated the hook.
|
||||
* @param string $replacement Optional. The hook that should have been used. Default null.
|
||||
* @param string $message Optional. A message regarding the change. Default null.
|
||||
* @param string $replacement Optional. The hook that should have been used. Default empty.
|
||||
* @param string $message Optional. A message regarding the change. Default empty.
|
||||
*/
|
||||
function do_action_deprecated( $tag, $args, $version, $replacement = null, $message = null ) {
|
||||
function do_action_deprecated( $tag, $args, $version, $replacement = '', $message = '' ) {
|
||||
if ( ! has_action( $tag ) ) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.5-alpha-48326';
|
||||
$wp_version = '5.5-alpha-48327';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue