-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[Console] Document timeout functionality for QuestionHelper #21369
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 7.4
Are you sure you want to change the base?
Conversation
This adds documentation for the setTimeout() method that was added to the Question class in Symfony 7.4. The timeout feature allows setting a maximum time limit for user input to prevent hanging indefinitely in interactive questions, particularly useful in database transactions or other time-sensitive operations. Closes symfony#21366
- Fix title underline length to match exactly 33 characters - Remove trailing whitespace from line 372
Setting a Timeout for User Input | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
.. versionadded:: 7.4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let move this at the end of this section please
$helper = new QuestionHelper(); | ||
|
||
$question = new Question('Please enter your answer'); | ||
$question->setTimeout(30); // 30 seconds timeout |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$question->setTimeout(30); // 30 seconds timeout | |
$question->setTimeout(seconds: 30); |
would be much better, but lets wait for @xabbuh and @javiereguiluz, because IIRC we don't use named arguments in the docs, as they are not covered by BC
|
||
// ... | ||
$question = new ConfirmationQuestion('Do you want to continue?', false); | ||
$question->setTimeout(10); // 10 seconds timeout |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$question->setTimeout(10); // 10 seconds timeout | |
$question->setTimeout(seconds: 10); |
See comment above
This adds documentation for the setTimeout() method that was added to the Question class in Symfony 7.4. The timeout feature allows setting a maximum time limit for user input to prevent hanging indefinitely in interactive questions, particularly useful in database transactions or other time-sensitive operations.
Closes #21366