src/Hook.php
public function replace(
        $hookName,
        $functionToReplace,
        $callable,
        $priority = 10,
        $acceptedArguments = 1,
        $create = true
    ) :bool {
        $hookName = $this->sanitizeKeyName($hookName);
        if (!$hookName) {
            throw new InvalidArgumentException(
                "Invalid Hook Name Specified",
                E_USER_ERROR
            );
        }

        if (!is_callable($callable)) {
            throw new RuntimeException(
                "Invalid Hook Callable Specified",
                E_USER_ERROR
            );
        }

        if (($has = $this->exists($hookName, $functionToReplace)) || $create) {
            $has && $this->remove($hookName, $functionToReplace);
            // add hooks first
            return $this->add($hookName, $callable, $priority, $acceptedArguments);
        }

        return false;
    }
public function replace(
        $hookName,
        $functionToReplace,
        $callable,
        $priority = 10,
        $acceptedArguments = 1,
        $create = true
    ) :bool {
        $hookName = $this->sanitizeKeyName($hookName);
        if (!$hookName) {
            throw new InvalidArgumentException(
                "Invalid Hook Name Specified",
                E_USER_ERROR
            );
        }

        if (!is_callable($callable)) {
            throw new RuntimeException(
                "Invalid Hook Callable Specified",
                E_USER_ERROR
            );
        }

        if (($has = $this->exists($hookName, $functionToReplace)) || $create) {
            $has && $this->remove($hookName, $functionToReplace);
            // add hooks first
            return $this->add($hookName, $callable, $priority, $acceptedArguments);
        }

        return false;
    }
public function replace ( $ hookName , $ functionToReplace , $ callable , $ priority = 10 , $ acceptedArguments = 1 , $ create = true ) : bool { $ hookName = $ this -> sanitizeKeyName ( $ hookName ) ; if ( ! $ hookName ) { throw new InvalidArgumentException ( "Invalid Hook Name Specified" , E_USER_ERROR ) ; } if ( ! is_callable ( $ callable ) ) { throw new RuntimeException ( "Invalid Hook Callable Specified" , E_USER_ERROR ) ; } if ( ( $ has = $ this -> exists ( $ hookName , $ functionToReplace ) ) || $ create ) { $ has && $ this -> remove ( $ hookName , $ functionToReplace ) ; // add hooks first return $ this -> add ( $ hookName , $ callable , $ priority , $ acceptedArguments ) ; } return false ; }
Replace Hooks Function, this will replace all existing hooks

@param  string   $hookName          Hook Name
@param  string   $functionToReplace Function to replace
@param  Callable $callable          Callable
@param  integer  $priority          priority
@param  integer  $acceptedArguments num count of accepted args / parameter
@param  boolean  $create            true if want to create new if not exists

@return boolean
@throws InvalidArgumentException
@throws RuntimeException
Replace Hooks Function this will replace all existing hooks