From 41a9c771fa9397156d3d07b62f1890b60a99b6f1 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sun, 20 Feb 2022 18:55:47 +0100 Subject: [PATCH] SyntaxError::getNormalizedMessage(): minor regex tweak By using `?:` at the start of a parenthesis group, the group will not be "remembered"/saved to memory. As this regex does not use the subgroups anyway, we don't need to remember them. --- src/Errors/SyntaxError.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Errors/SyntaxError.php b/src/Errors/SyntaxError.php index 529e9ba..09ff4a6 100644 --- a/src/Errors/SyntaxError.php +++ b/src/Errors/SyntaxError.php @@ -31,7 +31,7 @@ public function getLine() */ public function getNormalizedMessage($translateTokens = false) { - $message = preg_replace('~^(Parse|Fatal) error: (syntax error, )?~', '', $this->message); + $message = preg_replace('~^(?:Parse|Fatal) error: (?:syntax error, )?~', '', $this->message); $baseName = basename($this->filePath); $regex = sprintf(self::IN_ON_REGEX, preg_quote($baseName, '~')); $message = preg_replace($regex, '', $message, -1, $count);