Skip to content

Commit aad9b04

Browse files
committed
Color the outdated summary as a warning, not green success
The removable count was concatenated into the shared summary string, so it rendered inside the green success() line in one path and uncoloured in the other. "Outdated, action recommended" should not read as success. Emit it on its own warn() line in both report() and reportSkipped(), matching the verbose per-annotation warn() styling so the signal is consistent everywhere.
1 parent ede3fed commit aad9b04

1 file changed

Lines changed: 17 additions & 12 deletions

File tree

src/Annotator/AbstractAnnotator.php

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -921,16 +921,19 @@ protected function report(): void {
921921
if ($skipped) {
922922
$out[] = $skipped . ' ' . ($skipped === 1 ? 'annotation' : 'annotations') . ' skipped';
923923
}
924-
$removable = !empty($this->_counter[static::COUNT_REMOVABLE]) ? $this->_counter[static::COUNT_REMOVABLE] : 0;
925-
if ($removable) {
926-
$out[] = $removable . ' ' . ($removable === 1 ? 'annotation' : 'annotations') . ' outdated (run with -r to remove)';
927-
}
928924

929-
if (!$out) {
930-
return;
925+
if ($out) {
926+
$this->_io->success(' -> ' . implode(', ', $out) . '.');
931927
}
932928

933-
$this->_io->success(' -> ' . implode(', ', $out) . '.');
929+
// Outdated lines signal "action recommended", not success — emit
930+
// them on their own attention-coloured line (matches the verbose
931+
// per-annotation warn() above), never folded into the green
932+
// success summary.
933+
$removable = !empty($this->_counter[static::COUNT_REMOVABLE]) ? $this->_counter[static::COUNT_REMOVABLE] : 0;
934+
if ($removable) {
935+
$this->_io->warn(' -> ' . $removable . ' ' . ($removable === 1 ? 'annotation' : 'annotations') . ' outdated (run with -r to remove)');
936+
}
934937
}
935938

936939
/**
@@ -945,19 +948,21 @@ protected function reportSkipped(string $path): void {
945948
$out[] = $skipped . ' ' . ($skipped === 1 ? 'annotation' : 'annotations') . ' skipped';
946949
}
947950
$removable = !empty($this->_counter[static::COUNT_REMOVABLE]) ? $this->_counter[static::COUNT_REMOVABLE] : 0;
948-
if ($removable) {
949-
$out[] = $removable . ' ' . ($removable === 1 ? 'annotation' : 'annotations') . ' outdated (run with -r to remove)';
950-
}
951951

952-
if (!$out) {
952+
if (!$out && !$removable) {
953953
return;
954954
}
955955

956956
if (!$this->getConfig('verbose')) {
957957
$this->_io->out('-> ' . str_replace(ROOT . DS, '', $path));
958958
}
959959

960-
$this->_io->out(' -> ' . implode(', ', $out));
960+
if ($out) {
961+
$this->_io->out(' -> ' . implode(', ', $out));
962+
}
963+
if ($removable) {
964+
$this->_io->warn(' -> ' . $removable . ' ' . ($removable === 1 ? 'annotation' : 'annotations') . ' outdated (run with -r to remove)');
965+
}
961966
}
962967

963968
/**

0 commit comments

Comments
 (0)