Skip to content

Commit

Permalink
Tracy BlueScreen: Fix PhpStan errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
janbarasek committed Mar 21, 2022
1 parent 86928b0 commit a229e6b
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/TracyBlueScreenDebugger.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static function setPanel(?QueryPanel $panel): void
*/
public static function render(?\Throwable $e): ?array
{
if (!$e instanceof ORMException) {
if ($e === null) {
return null;
}
if ($e instanceof DriverException) {
Expand All @@ -58,9 +58,11 @@ public static function render(?\Throwable $e): ?array
} elseif ($e instanceof MappingException) {
$tab = 'MappingException';
$content = self::renderMapping($e);
} else {
} elseif ($e instanceof ORMException) {
$tab = 'ORM error';
$content = '<p>' . htmlspecialchars($e->getMessage()) . '</p>';
} else {
return null;
}

return [
Expand Down Expand Up @@ -322,7 +324,7 @@ private static function renderQueries(): string
. '<br><i title="Request runtime delay time">' . number_format($event->getDelayTime(), 2, '.', '') . '</i>'
. ($isTransaction ? '<br><span style="color:#bf0014">•</span>' : '')
. '</td>'
. '<td class="tracy-dbal-sql" ' . ($background ? ' style="background:' . $background . ' !important"' : '') . '>'
. '<td class="tracy-dbal-sql" ' . ($background !== null ? ' style="background:' . $background . ' !important"' : '') . '>'
. ($event->getDuration() === null
? '<div style="color:white;background:#bf0014;text-align:center;padding:2px 6px;margin:8px 0;border-radius:4px">Error with processing this query!</div>'
: '')
Expand All @@ -332,7 +334,7 @@ private static function renderQueries(): string
: ''
) . '</td></tr>';
$timeBlocks[] = '<td style="text-align:center;padding:0;' . ($durationColor !== null ? '' . $durationColor . '' : 'width:15px') . '">'
. ((int) round($durationMs))
. ((int) round((float) $durationMs))
. '</td>';

if ($event->getDuration() !== null) {
Expand All @@ -349,9 +351,7 @@ private static function renderQueries(): string
. ($other > 0 ? $other . '&times;other</span>' : '')
);
$return .= ']</p>';
if ($timeBlocks !== []) {
$return .= '<table><tr>' . implode('', $timeBlocks) . '</tr></table>';
}
$return .= '<table><tr>' . implode('', $timeBlocks) . '</tr></table>';

return sprintf('
%s
Expand Down

0 comments on commit a229e6b

Please sign in to comment.