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:
Sergey Biryukov
2020-07-05 21:09:03 +00:00
parent 87f464c283
commit 69e7e7681b
3 changed files with 27 additions and 31 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;
}