1- <?php
1+ <?php
22
33namespace SimpleMediaCode \Hooks ;
44
@@ -392,9 +392,12 @@ public static function build_preinitialized_hooks($filters)
392392 * @param mixed $offset An offset to check for.
393393 * @return bool True if the offset exists, false otherwise.
394394 */
395- public function offsetExists ($ offset )
395+ #[\ReturnTypeWillChange]
396+ public function offsetExists ($ offset ): bool
396397 {
397398 return isset ($ this ->callbacks [$ offset ]);
399+ // SOLUTION (not tested)
400+ // return in_array($offset, array_keys($this->callbacks, $offset), true);
398401 }
399402
400403 /**
@@ -405,7 +408,7 @@ public function offsetExists($offset)
405408 * @param mixed $offset The offset to retrieve.
406409 * @return mixed If set, the value at the specified offset, null otherwise.
407410 */
408- public function offsetGet ($ offset )
411+ public function offsetGet ($ offset ): mixed
409412 {
410413 return isset ($ this ->callbacks [$ offset ]) ? $ this ->callbacks [$ offset ] : null ;
411414 }
@@ -418,7 +421,7 @@ public function offsetGet($offset)
418421 * @param mixed $offset The offset to assign the value to.
419422 * @param mixed $value The value to set.
420423 */
421- public function offsetSet ($ offset , $ value )
424+ public function offsetSet ($ offset , $ value ): void
422425 {
423426 if (is_null ($ offset )) {
424427 $ this ->callbacks [] = $ value ;
@@ -434,7 +437,7 @@ public function offsetSet($offset, $value)
434437 *
435438 * @param mixed $offset The offset to unset.
436439 */
437- public function offsetUnset ($ offset )
440+ public function offsetUnset ($ offset ): void
438441 {
439442 unset($ this ->callbacks [$ offset ]);
440443 }
@@ -446,7 +449,7 @@ public function offsetUnset($offset)
446449 *
447450 * @return array Of callbacks at current priority.
448451 */
449- public function current ()
452+ public function current (): mixed
450453 {
451454 return current ($ this ->callbacks );
452455 }
@@ -460,6 +463,7 @@ public function current()
460463 *
461464 * @return array Of callbacks at next priority.
462465 */
466+ #[\ReturnTypeWillChange]
463467 public function next ()
464468 {
465469 return next ($ this ->callbacks );
@@ -474,7 +478,7 @@ public function next()
474478 *
475479 * @return mixed Returns current priority on success, or NULL on failure
476480 */
477- public function key ()
481+ public function key (): mixed
478482 {
479483 return key ($ this ->callbacks );
480484 }
@@ -488,7 +492,7 @@ public function key()
488492 *
489493 * @return bool Whether the current position is valid.
490494 */
491- public function valid ()
495+ public function valid (): bool
492496 {
493497 return key ($ this ->callbacks ) !== null ;
494498 }
@@ -500,9 +504,11 @@ public function valid()
500504 *
501505 * @link https://www.php.net/manual/en/iterator.rewind.php
502506 */
503- public function rewind ()
507+ #[ReturnTypeWillChange]
508+ public function rewind (): void
504509 {
505510 reset ($ this ->callbacks );
511+ //return;
506512 }
507513
508514 /**
@@ -552,4 +558,4 @@ public function wp_filter_build_unique_id($tag, $function, $priority)
552558 return $ function [0 ] . ':: ' . $ function [1 ];
553559 }
554560 }
555- }
561+ }
0 commit comments