From a229e6b05b2591a53c1e0cfb017063f512dec36d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Bar=C3=A1=C5=A1ek?=
Date: Mon, 21 Mar 2022 07:42:27 +0100
Subject: [PATCH] Tracy BlueScreen: Fix PhpStan errors.
---
src/TracyBlueScreenDebugger.php | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/TracyBlueScreenDebugger.php b/src/TracyBlueScreenDebugger.php
index 68838c7..1fa048e 100644
--- a/src/TracyBlueScreenDebugger.php
+++ b/src/TracyBlueScreenDebugger.php
@@ -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) {
@@ -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 = '' . htmlspecialchars($e->getMessage()) . '
';
+ } else {
+ return null;
}
return [
@@ -322,7 +324,7 @@ private static function renderQueries(): string
. '
' . number_format($event->getDelayTime(), 2, '.', '') . ''
. ($isTransaction ? '
•' : '')
. ''
- . ''
+ . ' | '
. ($event->getDuration() === null
? ' Error with processing this query! '
: '')
@@ -332,7 +334,7 @@ private static function renderQueries(): string
: ''
) . ' | ';
$timeBlocks[] = ''
- . ((int) round($durationMs))
+ . ((int) round((float) $durationMs))
. ' | ';
if ($event->getDuration() !== null) {
@@ -349,9 +351,7 @@ private static function renderQueries(): string
. ($other > 0 ? $other . '×other' : '')
);
$return .= ']
';
- if ($timeBlocks !== []) {
- $return .= '' . implode('', $timeBlocks) . '
';
- }
+ $return .= '' . implode('', $timeBlocks) . '
';
return sprintf('
%s