Docs: Correct @param type for the function parameter in tests_add_filter() and _test_filter_build_unique_id().

Synchronize documentation for `add_filter()`, `tests_add_filter()`, `_wp_filter_build_unique_id()`, `_test_filter_build_unique_id()`.

Add a note that `$tag` and `$priority` are no longer used in `_wp_filter_build_unique_id()` since [46220], and the function always returns a string now.

Props donmhico, remcotolsma, SergeyBiryukov.
Fixes #47407. See #48303.
Built from https://develop.svn.wordpress.org/trunk@46801


git-svn-id: http://core.svn.wordpress.org/trunk@46601 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov
2019-11-29 21:42:01 +00:00
parent 2a0489ec49
commit 49401759f3
3 changed files with 35 additions and 36 deletions

View File

@@ -64,14 +64,15 @@ final class WP_Hook implements Iterator, ArrayAccess {
*
* @param string $tag The name of the filter to hook the $function_to_add callback to.
* @param callable $function_to_add The callback to be run when the filter is applied.
* @param int $priority The order in which the functions associated with a
* particular action are executed. Lower numbers correspond with
* earlier execution, and functions with the same priority are executed
* in the order in which they were added to the action.
* @param int $priority The order in which the functions associated with a particular action
* are executed. Lower numbers correspond with earlier execution,
* and functions with the same priority are executed in the order
* in which they were added to the action.
* @param int $accepted_args The number of arguments the function accepts.
*/
public function add_filter( $tag, $function_to_add, $priority, $accepted_args ) {
$idx = _wp_filter_build_unique_id( $tag, $function_to_add, $priority );
$idx = _wp_filter_build_unique_id( $tag, $function_to_add, $priority );
$priority_existed = isset( $this->callbacks[ $priority ] );
$this->callbacks[ $priority ][ $idx ] = array(
@@ -162,8 +163,7 @@ final class WP_Hook implements Iterator, ArrayAccess {
*
* @since 4.7.0
*
* @param string $tag The filter hook to which the function to be removed is hooked. Used
* for building the callback ID when SPL is not available.
* @param string $tag The filter hook to which the function to be removed is hooked.
* @param callable $function_to_remove The callback to be removed from running when the filter is applied.
* @param int $priority The exact priority used when adding the original filter callback.
* @return bool Whether the callback existed before it was removed.
@@ -189,8 +189,7 @@ final class WP_Hook implements Iterator, ArrayAccess {
*
* @since 4.7.0
*
* @param string $tag Optional. The name of the filter hook. Used for building
* the callback ID when SPL is not available. Default empty.
* @param string $tag Optional. The name of the filter hook. Default empty.
* @param callable|bool $function_to_check Optional. The callback to check for. Default false.
* @return bool|int The priority of that hook is returned, or false if the function is not attached.
*/