Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"clue/ndjson-react": "^1.3",
"composer/pcre": "^3.4",
"composer/xdebug-handler": "^3.0.5",
"entropy/entropy": "^0.4.15",
"entropy/entropy": "^0.4.18",
"fidry/cpu-core-counter": "^1.3",
"friendsofphp/php-cs-fixer": "^3.95.20",
"nette/utils": "^4.1",
Expand Down
3 changes: 0 additions & 3 deletions src/Console/Style/EasyCodingStandardStyle.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,6 @@ public function printErrors(array $codingStandardErrors): void
*/
private function normalizeTags(string $text): string
{
// drop bold/underscore styling, keep the text
$text = (string) preg_replace('#<options=[^>]+>(.*?)</>#su', '$1', $text);

// <comment> → yellow, <info> → green
$text = (string) preg_replace('#<comment>(.*?)</comment>#su', '<fg=yellow>$1</>', $text);
$text = (string) preg_replace('#<info>(.*?)</info>#su', '<fg=green>$1</>', $text);
Expand Down
7 changes: 6 additions & 1 deletion tests/Console/Style/EasyCodingStandardStyleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,12 @@ public static function provideData(): Iterator

yield 'info tag becomes green' => ['<info>done</info>', '<fg=green>done</>'];

yield 'bold options are stripped, text kept' => ['<options=bold>title</>', 'title'];
yield 'bold options pass through to colorizer' => ['<options=bold>title</>', '<options=bold>title</>'];

yield 'underscore options pass through to colorizer' => [
'<options=underscore>Applied checkers:</>',
'<options=underscore>Applied checkers:</>',
];

yield 'explicit color closing tag is normalized' => ['<fg=red>err</fg=red>', '<fg=red>err</>'];

Expand Down
Loading