[Console] fixes some typos and phpdoc.

This commit is contained in:
Hugo Hamon 2014-12-07 11:44:23 +00:00
parent 002595a66b
commit 86840df972
3 changed files with 29 additions and 6 deletions

View File

@ -23,6 +23,13 @@ class ChoiceQuestion extends Question
private $prompt = ' > ';
private $errorMessage = 'Value "%s" is invalid';
/**
* Constructor.
*
* @param string $question The question to ask to the user
* @param array $choices The list of available choices
* @param mixed $default The default answer to return
*/
public function __construct($question, array $choices, $default = null)
{
parent::__construct($question, $default);
@ -100,6 +107,11 @@ class ChoiceQuestion extends Question
return $this;
}
/**
* Returns the default answer validator.
*
* @return callable
*/
private function getDefaultValidator()
{
$choices = $this->choices;

View File

@ -18,6 +18,12 @@ namespace Symfony\Component\Console\Question;
*/
class ConfirmationQuestion extends Question
{
/**
* Constructor.
*
* @param string $question The question to ask to the user
* @param bool $default The default answer to return, true or false
*/
public function __construct($question, $default = true)
{
parent::__construct($question, (bool) $default);
@ -25,6 +31,11 @@ class ConfirmationQuestion extends Question
$this->setNormalizer($this->getDefaultNormalizer());
}
/**
* Returns the default answer normalizer.
*
* @return callable
*/
private function getDefaultNormalizer()
{
$default = $this->getDefault();

View File

@ -116,7 +116,7 @@ class Question
/**
* Gets values for the autocompleter.
*
* @return null|array|Traversable
* @return null|array|\Traversable
*/
public function getAutocompleterValues()
{
@ -126,7 +126,7 @@ class Question
/**
* Sets values for the autocompleter.
*
* @param null|array|Traversable $values
* @param null|array|\Traversable $values
*
* @return Question The current instance
*
@ -165,7 +165,7 @@ class Question
}
/**
* Gets the validator for the question
* Gets the validator for the question.
*
* @return null|callable
*/
@ -211,9 +211,9 @@ class Question
/**
* Sets a normalizer for the response.
*
* The normalizer can ba a callable (a string), a closure or a class implementing __invoke.
* The normalizer can be a callable (a string), a closure or a class implementing __invoke.
*
* @param string|Closure $normalizer
* @param string|\Closure $normalizer
*
* @return Question The current instance
*/
@ -229,7 +229,7 @@ class Question
*
* The normalizer can ba a callable (a string), a closure or a class implementing __invoke.
*
* @return string|Closure
* @return string|\Closure
*/
public function getNormalizer()
{