src/Valkyrja/Dispatcher/NativeDispatcher.php
public function dispatchClass(Dispatch $dispatch, array $arguments = null)
    {
        // Ensure a class exists before continuing
        if (null === $dispatch->getClass()) {
            return $dispatch->getClass();
        }

        // If the class is the id then this item is not yet set
        // in the service container yet so it needs a new
        // instance returned
        if ($dispatch->getClass() === $dispatch->getId()) {
            // Get the class from the dispatcher
            $class = $dispatch->getClass();

            // If there are argument
            if (null !== $arguments) {
                // Get a new class instance with the arguments
                $class = new $class(...$arguments);
            } else {
                // Otherwise just get a new class instance
                $class = new $class();
            }
        } else {
            // Set the class through the container
            $class = $this->app->container()->get(
                $dispatch->getClass(),
                $arguments
            );
        }

        return $class ?? $this->DISPATCHED;
    }
public function dispatchClass(Dispatch $dispatch, array $arguments = null)
    {
        // Ensure a class exists before continuing
        if (null === $dispatch->getClass()) {
            return $dispatch->getClass();
        }

        // If the class is the id then this item is not yet set
        // in the service container yet so it needs a new
        // instance returned
        if ($dispatch->getClass() === $dispatch->getId()) {
            // Get the class from the dispatcher
            $class = $dispatch->getClass();

            // If there are argument
            if (null !== $arguments) {
                // Get a new class instance with the arguments
                $class = new $class(...$arguments);
            } else {
                // Otherwise just get a new class instance
                $class = new $class();
            }
        } else {
            // Set the class through the container
            $class = $this->app->container()->get(
                $dispatch->getClass(),
                $arguments
            );
        }

        return $class ?? $this->DISPATCHED;
    }
Dispatch a class.

@param Dispatch $dispatch  The dispatch
@param array    $arguments [optional] The arguments

@return mixed