private function getKernelObject($kernel): KernelInterface
    {
        if ($kernel instanceof KernelInterface) {
            return $kernel;
        } elseif (is_callable($kernel)) {
            return new CallbackKernel($kernel);
        }

        throw new \InvalidArgumentException('Kernel must be callable or an instance of KernelInterface');
    }
private function getKernelObject($kernel): KernelInterface
    {
        if ($kernel instanceof KernelInterface) {
            return $kernel;
        } elseif (is_callable($kernel)) {
            return new CallbackKernel($kernel);
        }

        throw new \InvalidArgumentException('Kernel must be callable or an instance of KernelInterface');
    }
private function getKernelObject ( $ kernel ) : KernelInterface { if ( $ kernel instanceof KernelInterface ) { return $ kernel ; } elseif ( is_callable ( $ kernel ) ) { return new CallbackKernel ( $ kernel ) ; } throw new \ InvalidArgumentException ( 'Kernel must be callable or an instance of KernelInterface' ) ; }
Converts the kernel parameter to an object implementing the KernelInterface
if it is a callable.

Otherwise returns the object directly.

@param KernelInterface|callable $kernel The kernel

@return KernelInterface The kernel as an object implementing the KernelInterface
Converts the kernel parameter to an object implementing the KernelInterface if it is a callable .