src/Server/MiddlewareStack.php
public function push($middleware)
    {
        if (! $middleware instanceof MiddlewareInterface &&
            ! is_callable($middleware)
        ) {
            throw new InvalidArgumentException(
                "Middleware stack accepts only MiddlewareInterface object or callable"
            );
        }

        array_push($this->middlewareStack, $middleware);
        return $this;
    }
public function push($middleware)
    {
        if (! $middleware instanceof MiddlewareInterface &&
            ! is_callable($middleware)
        ) {
            throw new InvalidArgumentException(
                "Middleware stack accepts only MiddlewareInterface object or callable"
            );
        }

        array_push($this->middlewareStack, $middleware);
        return $this;
    }
Pushes a middleware to the stack

@param MiddlewareInterface|callable $middleware

@return MiddlewareStack