function StackTraceFormatter::frames
@psalm-return Frames @psalm-suppress PossiblyUndefinedArrayOffset @psalm-suppress InvalidArrayOffset
1 call to StackTraceFormatter::frames()
- StackTraceFormatter::format in vendor/
open-telemetry/ sdk/ Common/ Exception/ StackTraceFormatter.php - Formats an exception in a java-like format.
File
-
vendor/
open-telemetry/ sdk/ Common/ Exception/ StackTraceFormatter.php, line 130
Class
- StackTraceFormatter
- @psalm-type Frame = array{ function: string, class: ?class-string, file: ?string, line: ?int, } @psalm-type Frames = non-empty-list<Frame>
Namespace
OpenTelemetry\SDK\Common\ExceptionCode
private static function frames(Throwable $e) : array {
$frames = [];
$trace = $e->getTrace();
$traceCount = count($trace);
for ($i = 0; $i < $traceCount + 1; $i++) {
$frames[] = [
'function' => $trace[$i]['function'] ?? '{main}',
'class' => $trace[$i]['class'] ?? null,
'file' => $trace[$i - 1]['file'] ?? null,
'line' => $trace[$i - 1]['line'] ?? null,
];
}
$frames[0]['file'] = $e->getFile();
$frames[0]['line'] = $e->getLine();
/** @psalm-var Frames $frames */
return $frames;
}