wp/wp-includes/class-wp-hook.php
changeset 19 3d72ae0968f4
parent 18 be944660c56a
child 21 48c4eec2b7e6
--- a/wp/wp-includes/class-wp-hook.php	Wed Sep 21 18:19:35 2022 +0200
+++ b/wp/wp-includes/class-wp-hook.php	Tue Sep 27 16:37:53 2022 +0200
@@ -168,9 +168,11 @@
 	 *
 	 * @since 4.7.0
 	 *
-	 * @param string   $hook_name The filter hook to which the function to be removed is hooked.
-	 * @param callable $callback  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.
+	 * @param string                $hook_name The filter hook to which the function to be removed is hooked.
+	 * @param callable|string|array $callback  The callback to be removed from running when the filter is applied.
+	 *                                         This method can be called unconditionally to speculatively remove
+	 *                                         a callback that may or may not exist.
+	 * @param int                   $priority  The exact priority used when adding the original filter callback.
 	 * @return bool Whether the callback existed before it was removed.
 	 */
 	public function remove_filter( $hook_name, $callback, $priority ) {
@@ -201,8 +203,10 @@
 	 *
 	 * @since 4.7.0
 	 *
-	 * @param string         $hook_name Optional. The name of the filter hook. Default empty.
-	 * @param callable|false $callback  Optional. The callback to check for. Default false.
+	 * @param string                      $hook_name Optional. The name of the filter hook. Default empty.
+	 * @param callable|string|array|false $callback  Optional. The callback to check for.
+	 *                                               This method can be called unconditionally to speculatively check
+	 *                                               a callback that may or may not exist. Default false.
 	 * @return bool|int If `$callback` is omitted, returns boolean for whether the hook has
 	 *                  anything registered. When checking a specific function, the priority
 	 *                  of that hook is returned, or false if the function is not attached.
@@ -437,6 +441,7 @@
 	 * @param mixed $offset An offset to check for.
 	 * @return bool True if the offset exists, false otherwise.
 	 */
+	#[ReturnTypeWillChange]
 	public function offsetExists( $offset ) {
 		return isset( $this->callbacks[ $offset ] );
 	}
@@ -451,6 +456,7 @@
 	 * @param mixed $offset The offset to retrieve.
 	 * @return mixed If set, the value at the specified offset, null otherwise.
 	 */
+	#[ReturnTypeWillChange]
 	public function offsetGet( $offset ) {
 		return isset( $this->callbacks[ $offset ] ) ? $this->callbacks[ $offset ] : null;
 	}
@@ -465,6 +471,7 @@
 	 * @param mixed $offset The offset to assign the value to.
 	 * @param mixed $value The value to set.
 	 */
+	#[ReturnTypeWillChange]
 	public function offsetSet( $offset, $value ) {
 		if ( is_null( $offset ) ) {
 			$this->callbacks[] = $value;
@@ -482,6 +489,7 @@
 	 *
 	 * @param mixed $offset The offset to unset.
 	 */
+	#[ReturnTypeWillChange]
 	public function offsetUnset( $offset ) {
 		unset( $this->callbacks[ $offset ] );
 	}
@@ -495,6 +503,7 @@
 	 *
 	 * @return array Of callbacks at current priority.
 	 */
+	#[ReturnTypeWillChange]
 	public function current() {
 		return current( $this->callbacks );
 	}
@@ -508,6 +517,7 @@
 	 *
 	 * @return array Of callbacks at next priority.
 	 */
+	#[ReturnTypeWillChange]
 	public function next() {
 		return next( $this->callbacks );
 	}
@@ -521,6 +531,7 @@
 	 *
 	 * @return mixed Returns current priority on success, or NULL on failure
 	 */
+	#[ReturnTypeWillChange]
 	public function key() {
 		return key( $this->callbacks );
 	}
@@ -534,6 +545,7 @@
 	 *
 	 * @return bool Whether the current position is valid.
 	 */
+	#[ReturnTypeWillChange]
 	public function valid() {
 		return key( $this->callbacks ) !== null;
 	}
@@ -545,6 +557,7 @@
 	 *
 	 * @link https://www.php.net/manual/en/iterator.rewind.php
 	 */
+	#[ReturnTypeWillChange]
 	public function rewind() {
 		reset( $this->callbacks );
 	}