Skip to content

Commit

Permalink
bug #12806 [Console] Removed the use of $this->getHelperSet() as it i…
Browse files Browse the repository at this point in the history
…s null by default (saro0h)

This PR was submitted for the 2.6 branch but it was merged into the 2.5 branch instead (closes #12806).

Discussion
----------

[Console] Removed the use of $this->getHelperSet() as it is null by default

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #12805
| License       | MIT
| Doc PR        | ~

Before:
![capture d ecran 2014-12-02 a 15 51 38](https://cloud.githubusercontent.com/assets/667519/5264798/303bf87a-7a3e-11e4-9b45-68e8a86bab60.png)

After:
![capture d ecran 2014-12-02 a 16 36 25](https://cloud.githubusercontent.com/assets/667519/5265299/b13190d6-7a41-11e4-9e68-d889ea290cae.png)

Commits
-------

111b194 Added information when an error occured during validation of an answer of a question
  • Loading branch information
fabpot committed Dec 8, 2014
2 parents 6104fe0 + 111b194 commit 99369a2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Symfony/Component/Console/Helper/QuestionHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,13 @@ private function validateAttempts($interviewer, OutputInterface $output, Questio
$attempts = $question->getMaxAttempts();
while (null === $attempts || $attempts--) {
if (null !== $error) {
$output->writeln($this->getHelperSet()->get('formatter')->formatBlock($error->getMessage(), 'error'));
if (null !== $this->getHelperSet() && $this->getHelperSet()->has('formatter')) {
$message = $this->getHelperSet()->get('formatter')->formatBlock($error->getMessage(), 'error');
} else {
$message = '<error>'.$error->getMessage().'</error>';
}

$output->writeln($message);
}

try {
Expand Down

0 comments on commit 99369a2

Please sign in to comment.