Skip to content

Conversation

janedbal
Copy link

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

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
Copy link
Contributor

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$question->setTimeout(10); // 10 seconds timeout
$question->setTimeout(seconds: 10);

See comment above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants