src/WordPress/AddWpHookCapableTrait.php
protected function _addWpHook($name, callable $handler, $priority = null, $numArgs = 1)
    {
        $name = $this->_normalizeString($name);

        $priority = ($priority === null)
            ? $this->_getWpHookDefaultPriority()
            : $this->_normalizeInt($priority);

        $numArgs = ($numArgs === null)
            ? 1
            : $this->_normalizeInt($numArgs);

        \add_filter($name, $handler, $priority, $numArgs);
    }
protected function _addWpHook($name, callable $handler, $priority = null, $numArgs = 1)
    {
        $name = $this->_normalizeString($name);

        $priority = ($priority === null)
            ? $this->_getWpHookDefaultPriority()
            : $this->_normalizeInt($priority);

        $numArgs = ($numArgs === null)
            ? 1
            : $this->_normalizeInt($numArgs);

        \add_filter($name, $handler, $priority, $numArgs);
    }
Adds a hook handler to a WordPress event.

@since [*next-version*]

@param string|Stringable $name     The hook name.
@param callable          $handler  The hook handler callback.
@param int|null          $priority The priority of the hook - larger numbers signify later execution.
@param int|null          $numArgs  The number of arguments to accept from the event invoker.

@throws InvalidArgumentException If the $name, $priority or $numArgs arguments are invalid.