Skip to content

Commit

Permalink
minor #6190 DX: DiffConsoleFormatter - escape - (keradus)
Browse files Browse the repository at this point in the history
This PR was merged into the master branch.

Discussion
----------

DX: DiffConsoleFormatter - escape -

https://github.com/FriendsOfPHP/PHP-CS-Fixer/pull/6183/files#r770714802

Original form, depending on language or analyser, may trigger a warning.

> https://www.regular-expressions.info/charclass.html
> In most regex flavors, the only special characters or metacharacters inside a character class are the closing bracket ], the backslash \, the caret ^, and the hyphen -. The usual metacharacters are normal characters inside a character class, and do not need to be escaped by a backslash

Commits
-------

23aaa2e DX: DiffConsoleFormatter - escape -
  • Loading branch information
SpacePossum committed Dec 20, 2021
2 parents b317fb7 + 23aaa2e commit a0fe01e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Differ/DiffConsoleFormatter.php
Expand Up @@ -58,7 +58,7 @@ static function (string $line) use ($isDecorated, $lineTemplate): string {
if ($isDecorated) {
$count = 0;
$line = Preg::replaceCallback(
'/^([+-@].*)/',
'/^([+\-@].*)/',
static function (array $matches): string {
if ('+' === $matches[0][0]) {
$colour = 'green';
Expand Down

0 comments on commit a0fe01e

Please sign in to comment.