Skip to content

Commit 1099df9

Browse files
committed
Optimize exception context string
1 parent 75be90e commit 1099df9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/ExceptionContext.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ public static function getContextAsString(Throwable $exception)
2929

3030
$exceptionLine = $exception->getLine();
3131

32-
$markedExceptionLine = sprintf('> %s', $exceptionLine);
32+
$markedExceptionLine = sprintf(' %s', $exceptionLine);
3333

34-
$maxLineLen = max(strlen(array_key_last($context)), strlen($markedExceptionLine));
34+
$maxLineLen = max(mb_strlen(array_key_last($context)), mb_strlen($markedExceptionLine));
3535

3636
$contextString = PHP_EOL.array_reduces(
3737
$context,
@@ -40,7 +40,7 @@ function ($carry, $code, $line) use ($maxLineLen, $exceptionLine, $markedExcepti
4040

4141
$line = str_pad($line, $maxLineLen, ' ', STR_PAD_LEFT);
4242

43-
return "$carry $line $code".PHP_EOL;
43+
return "$carry $line $code".PHP_EOL;
4444
},
4545
''
4646
);

0 commit comments

Comments
 (0)