src/Viserio/Component/Routing/Traits/MiddlewareValidatorTrait.php
protected function validateMiddleware($middleware): void
    {
        $middleware = $this->getMiddlewareClassName($middleware);
        $interfaces = \class_implements($middleware);

        if (! isset($interfaces[MiddlewareInterface::class])) {
            throw new UnexpectedValueException(
                \sprintf('%s is not implemented in [%s].', MiddlewareInterface::class, $middleware)
            );
        }
    }
protected function validateMiddleware($middleware): void
    {
        $middleware = $this->getMiddlewareClassName($middleware);
        $interfaces = \class_implements($middleware);

        if (! isset($interfaces[MiddlewareInterface::class])) {
            throw new UnexpectedValueException(
                \sprintf('%s is not implemented in [%s].', MiddlewareInterface::class, $middleware)
            );
        }
    }
Validates if given object or string has a middleware interface.

@param \Psr\Http\Server\MiddlewareInterface|string $middleware

@throws \Viserio\Component\Contract\Routing\Exception\UnexpectedValueException if \Psr\Http\Server\MiddlewareInterface was not found

@return void