Skip to content

Commit 41a9c77

Browse files
jrfnlgrogy
authored andcommitted
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.
1 parent c592842 commit 41a9c77

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: src/Errors/SyntaxError.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function getLine()
3131
*/
3232
public function getNormalizedMessage($translateTokens = false)
3333
{
34-
$message = preg_replace('~^(Parse|Fatal) error: (syntax error, )?~', '', $this->message);
34+
$message = preg_replace('~^(?:Parse|Fatal) error: (?:syntax error, )?~', '', $this->message);
3535
$baseName = basename($this->filePath);
3636
$regex = sprintf(self::IN_ON_REGEX, preg_quote($baseName, '~'));
3737
$message = preg_replace($regex, '', $message, -1, $count);

0 commit comments

Comments
 (0)