function Question::setMaxAttempts
Sets the maximum number of attempts.
Null means an unlimited number of attempts.
Return value
$this
Throws
InvalidArgumentException in case the number of attempts is invalid
File
-
vendor/
symfony/ console/ Question/ Question.php, line 216
Class
- Question
- Represents a Question.
Namespace
Symfony\Component\Console\QuestionCode
public function setMaxAttempts(?int $attempts) : static {
if (null !== $attempts && $attempts < 1) {
throw new InvalidArgumentException('Maximum number of attempts must be a positive value.');
}
$this->attempts = $attempts;
return $this;
}