src/Middleware/Pipeline/Exception/InvalidMiddlewareException.php
public static function invalidType($item): self
    {
        return new static(sprintf(
            'Middlewares must be an object implementing "%s", "%s given".',
            MiddlewareInterface::class,
            is_object($item) ? get_class($item) : gettype($item)
        ));
    }
public static function invalidType($item): self
    {
        return new static(sprintf(
            'Middlewares must be an object implementing "%s", "%s given".',
            MiddlewareInterface::class,
            is_object($item) ? get_class($item) : gettype($item)
        ));
    }
@param mixed $item

@return InvalidMiddlewareException