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.

git-svn-id: https://develop.svn.wordpress.org/trunk@48327 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2020-07-05 21:07:48 +00:00
parent b1b1b08e43
commit 09921a5283
2 changed files with 26 additions and 30 deletions

View File

@@ -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;
}