filp/whoops · error · InvalidArgumentException

Argument to Whoops\Handler\PlainTextHandler::setLogger must

Error message

Argument to Whoops\Handler\PlainTextHandler::setLogger must be a valid Logger Interface (aka. Monolog), get_class($logger) given.

What it means

Error "Argument to Whoops\Handler\PlainTextHandler::setLogger must be a valid Logger Interface (aka. Monolog), get_class($logger) given." thrown in filp/whoops.

Source

Thrown at src/Whoops/Handler/PlainTextHandler.php:78

     * Constructor.
     * @throws InvalidArgumentException     If argument is not null or a LoggerInterface
     * @param  \Psr\Log\LoggerInterface|null $logger
     */
    public function __construct($logger = null)
    {
        $this->setLogger($logger);
    }

    /**
     * Set the output logger interface.
     * @throws InvalidArgumentException     If argument is not null or a LoggerInterface
     * @param  \Psr\Log\LoggerInterface|null $logger
     */
    public function setLogger($logger = null)
    {
        if (! (is_null($logger)
            || $logger instanceof LoggerInterface)) {
            throw new InvalidArgumentException(
                'Argument to ' . __METHOD__ .
                " must be a valid Logger Interface (aka. Monolog), " .
                get_class($logger) . ' given.'
            );
        }

        $this->logger = $logger;
    }

    /**
     * @return \Psr\Log\LoggerInterface|null
     */
    public function getLogger()
    {
        return $this->logger;
    }

    /**

View on GitHub (pinned to fa1bc9c95a)

When it happens

Trigger: Thrown at src/Whoops/Handler/PlainTextHandler.php:78 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of filp/whoops@fa1bc9c95a (2026-08-21). Data as JSON: /api/errors/4a8f74208362becb. Report an issue: GitHub.