public function Question::setAutocompleterValues in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/console/Question/Question.php \Symfony\Component\Console\Question\Question::setAutocompleterValues()
Sets values for the autocompleter.
Parameters
null|array|\Traversable $values:
Return value
Question The current instance
Throws
\InvalidArgumentException
\LogicException
1 call to Question::setAutocompleterValues()
- ChoiceQuestion::__construct in vendor/
symfony/ console/ Question/ ChoiceQuestion.php - Constructor.
File
- vendor/
symfony/ console/ Question/ Question.php, line 136
Class
- Question
- Represents a Question.
Namespace
Symfony\Component\Console\QuestionCode
public function setAutocompleterValues($values) {
if (is_array($values) && $this
->isAssoc($values)) {
$values = array_merge(array_keys($values), array_values($values));
}
if (null !== $values && !is_array($values)) {
if (!$values instanceof \Traversable || $values instanceof \Countable) {
throw new \InvalidArgumentException('Autocompleter values can be either an array, `null` or an object implementing both `Countable` and `Traversable` interfaces.');
}
}
if ($this->hidden) {
throw new \LogicException('A hidden question cannot use the autocompleter.');
}
$this->autocompleterValues = $values;
return $this;
}