<?php
function exceptionHandler($exception)
{
    print_r(array_reverse(xdebug_get_function_stack()));
}

class Elephpant
{
    function __construct(private string $title, private float $PIE) {}
}

class Error_Class
{
    public static function newError($errno = false)
    {
        $elephpant = new Elephpant("Bluey", M_PI);
        $randoVar = 42;
        throw new Exception("My Exception");
    }
}

set_exception_handler('exceptionHandler');

$e = Error_Class::newError(42);
Output