Skip to content

Commit 6cd3715

Browse files
committed
move error message has Uncaught prefix to private function
1 parent f50fd85 commit 6cd3715

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/HeroTrait.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,21 @@ trait HeroTrait
2222
/** @var string */
2323
private $result = '';
2424

25+
private static function isUncaught(array $error)
26+
{
27+
return 0 === strpos($error['message'], 'Uncaught');
28+
}
29+
2530
public function phpFatalErrorHandler($buffer): string
2631
{
2732
$error = \error_get_last();
2833
if (! $error) {
2934
return $buffer;
3035
}
3136

32-
if (0 === strpos($error['message'], 'Uncaught')) {
33-
return $buffer;
34-
}
35-
36-
return $this->result === '' ? $buffer : $this->result;
37+
return self::isUncaught($error) || $this->result === ''
38+
? $buffer
39+
: $this->result;
3740
}
3841

3942
public function execOnShutdown() : void
@@ -43,7 +46,7 @@ public function execOnShutdown() : void
4346
return;
4447
}
4548

46-
if (0 === strpos($error['message'], 'Uncaught')) {
49+
if (self::isUncaught($error)) {
4750
return;
4851
}
4952

0 commit comments

Comments
 (0)