Skip to content

Commit 7aaf99d

Browse files
committed
feature #37415 [Console] added info method to symfony style (titospeakap, titomiguelcosta)
This PR was merged into the 5.2-dev branch. Discussion ---------- [Console] added info method to symfony style | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | | License | MIT | Doc PR | It would be nice to have an info method as part of the SymfonyStyle class. This would prevent having to use the \<INFO\> tag, and it is consistent with other methods like warning and error (similar to the types available in monolog) Commits ------- 4cf1a1e fixed docblock 204cd73 added info method to symfony style
2 parents 32941f2 + 4cf1a1e commit 7aaf99d

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

src/Symfony/Component/Console/Style/SymfonyStyle.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,16 @@ public function note($message)
163163
$this->block($message, 'NOTE', 'fg=yellow', ' ! ');
164164
}
165165

166+
/**
167+
* Formats an info message.
168+
*
169+
* @param string|array $message
170+
*/
171+
public function info($message)
172+
{
173+
$this->block($message, 'INFO', 'fg=green', ' ', true);
174+
}
175+
166176
/**
167177
* {@inheritdoc}
168178
*/

src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/command/command_2.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@
1212
$output->error('Error');
1313
$output->success('Success');
1414
$output->note('Note');
15+
$output->info('Info');
1516
$output->block('Custom block', 'CUSTOM', 'fg=white;bg=green', 'X ', true);
1617
};

src/Symfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/output/output_2.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,7 @@
99

1010
! [NOTE] Note
1111

12+
[INFO] Info
13+
1214
X [CUSTOM] Custom block
1315

0 commit comments

Comments
 (0)