Skip to content

Commit

Permalink
minor #6183 Simplify DiffConsoleFormatter (kubawerlos)
Browse files Browse the repository at this point in the history
This PR was merged into the master branch.

Discussion
----------

Simplify DiffConsoleFormatter

This is actually only place where any `Preg` method is called with an array (of patterns), not a string.

To be continued: #6184.

Commits
-------

cf4dcc4 Simplify DiffConsoleFormatter
  • Loading branch information
SpacePossum committed Dec 16, 2021
2 parents 24999a0 + cf4dcc4 commit b4b6d13
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/Differ/DiffConsoleFormatter.php
Expand Up @@ -58,11 +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 b4b6d13

Please sign in to comment.