Skip to content

Commit 1f4dc76

Browse files
author
Vincent Composieux
committed
[Console] Fix Console some $app to $this and getHelperSet()->get() to getHelper()
1 parent 1938c2f commit 1f4dc76

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

components/console/helpers/dialoghelper.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ functions to ask the user for more information. It is included in the default
1616
helper set, which you can get by calling
1717
:method:`Symfony\\Component\\Console\\Command\\Command::getHelperSet`::
1818

19-
$dialog = $this->getHelperSet()->get('dialog');
19+
$dialog = $this->getHelper('dialog');
2020

2121
All the methods inside the Dialog Helper have an
2222
:class:`Symfony\\Component\\Console\\Output\\OutputInterface` as the first
@@ -69,7 +69,7 @@ Autocompletion
6969
You can also specify an array of potential answers for a given question. These
7070
will be autocompleted as the user types::
7171

72-
$dialog = $this->getHelperSet()->get('dialog');
72+
$dialog = $this->getHelper('dialog');
7373
$bundleNames = array('AcmeDemoBundle', 'AcmeBlogBundle', 'AcmeStoreBundle');
7474
$name = $dialog->ask(
7575
$output,
@@ -84,7 +84,7 @@ Hiding the User's Response
8484
You can also ask a question and hide the response. This is particularly
8585
convenient for passwords::
8686

87-
$dialog = $this->getHelperSet()->get('dialog');
87+
$dialog = $this->getHelper('dialog');
8888
$password = $dialog->askHiddenResponse(
8989
$output,
9090
'What is the database password?',
@@ -152,7 +152,7 @@ Validating a Hidden Response
152152

153153
You can also ask and validate a hidden response::
154154

155-
$dialog = $this->getHelperSet()->get('dialog');
155+
$dialog = $this->getHelper('dialog');
156156

157157
$validator = function ($value) {
158158
if ('' === trim($value)) {
@@ -186,7 +186,7 @@ Instead, you can use the
186186
method, which makes sure that the user can only enter a valid string
187187
from a predefined list::
188188

189-
$dialog = $this->getHelperSet()->get('dialog');
189+
$dialog = $this->getHelper('dialog');
190190
$colors = array('red', 'blue', 'yellow');
191191

192192
$color = $dialog->select(

components/console/helpers/formatterhelper.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ The :class:`Symfony\\Component\\Console\\Helper\\FormatterHelper` is included
1212
in the default helper set, which you can get by calling
1313
:method:`Symfony\\Component\\Console\\Command\\Command::getHelperSet`::
1414

15-
$formatter = $this->getHelperSet()->get('formatter');
15+
$formatter = $this->getHelper('formatter');
1616

1717
The methods return a string, which you'll usually render to the console by
1818
passing it to the

components/console/helpers/progresshelper.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ information, which updates as your command runs:
2525
To display progress details, use the :class:`Symfony\\Component\\Console\\Helper\\ProgressHelper`,
2626
pass it a total number of units, and advance the progress as your command executes::
2727

28-
$progress = $this->getHelperSet()->get('progress');
28+
$progress = $this->getHelper('progress');
2929

3030
$progress->start($output, 50);
3131
$i = 0;

components/console/helpers/questionhelper.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ functions to ask the user for more information. It is included in the default
1212
helper set, which you can get by calling
1313
:method:`Symfony\\Component\\Console\\Command\\Command::getHelperSet`::
1414

15-
$helper = $this->getHelperSet()->get('question');
15+
$helper = $this->getHelper('question');
1616

1717
The Question Helper has a single method
1818
:method:`Symfony\\Component\\Console\\Command\\Command::ask` that needs an
@@ -30,7 +30,7 @@ the following to your command::
3030
use Symfony\Component\Console\Question\ConfirmationQuestion;
3131
// ...
3232

33-
$helper = $this->getHelperSet()->get('question');
33+
$helper = $this->getHelper('question');
3434
$question = new ConfirmationQuestion('Continue with this action?', false);
3535

3636
if (!$helper->ask($input, $output, $question)) {
@@ -73,7 +73,7 @@ from a predefined list::
7373
use Symfony\Component\Console\Question\ChoiceQuestion;
7474
// ...
7575

76-
$helper = $app->getHelperSet()->get('question');
76+
$helper = $this->getHelper('question');
7777
$question = new ChoiceQuestion(
7878
'Please select your favorite color (defaults to red)',
7979
array('red', 'blue', 'yellow'),
@@ -107,7 +107,7 @@ this use :method:`Symfony\\Component\\Console\\Question\\ChoiceQuestion::setMult
107107
use Symfony\Component\Console\Question\ChoiceQuestion;
108108
// ...
109109

110-
$helper = $app->getHelperSet()->get('question');
110+
$helper = $this->getHelper('question');
111111
$question = new ChoiceQuestion(
112112
'Please select your favorite color (defaults to red)',
113113
array('red', 'blue', 'yellow'),
@@ -206,7 +206,7 @@ You can also use a validator with a hidden question::
206206
use Symfony\Component\Console\Question\Question;
207207
// ...
208208

209-
$helper = $this->getHelperSet()->get('question');
209+
$helper = $this->getHelper('question');
210210

211211
$question = new Question('Please enter your password');
212212
$question->setValidator(function ($value) {

components/console/helpers/tablehelper.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ When building a console application it may be useful to display tabular data:
2121
To display a table, use the :class:`Symfony\\Component\\Console\\Helper\\TableHelper`,
2222
set headers, rows and render::
2323

24-
$table = $this->getHelperSet()->get('table');
24+
$table = $this->getHelper('table');
2525
$table
2626
->setHeaders(array('ISBN', 'Title', 'Author'))
2727
->setRows(array(

0 commit comments

Comments
 (0)