filp/whoops · error · UnexpectedValueException

Callable to Whoops\Exception\FrameCollection::map must retur

Error message

Callable to Whoops\Exception\FrameCollection::map must return a Frame object

What it means

Error "Callable to Whoops\Exception\FrameCollection::map must return a Frame object" thrown in filp/whoops.

Source

Thrown at src/Whoops/Exception/FrameCollection.php:61

        $this->frames = array_values(array_filter($this->frames, $callable));
        return $this;
    }

    /**
     * Map the collection of frames
     *
     * @param  callable        $callable
     * @return FrameCollection
     */
    public function map($callable)
    {
        // Contain the map within a higher-order callable
        // that enforces type-correctness for the $callable
        $this->frames = array_map(function ($frame) use ($callable) {
            $frame = call_user_func($callable, $frame);

            if (!$frame instanceof Frame) {
                throw new UnexpectedValueException(
                    "Callable to " . __CLASS__ . "::map must return a Frame object"
                );
            }

            return $frame;
        }, $this->frames);

        return $this;
    }

    /**
     * Returns an array with all frames, does not affect
     * the internal array.
     *
     * @todo   If this gets any more complex than this,
     *         have getIterator use this method.
     * @see    FrameCollection::getIterator
     * @return array

View on GitHub (pinned to fa1bc9c95a)

When it happens

Trigger: Thrown at src/Whoops/Exception/FrameCollection.php:61 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/c1258986137af94e. Report an issue: GitHub.