Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. SymfonyStyle.php

function SymfonyStyle::askQuestion

4 calls to SymfonyStyle::askQuestion()
SymfonyStyle::ask in vendor/symfony/console/Style/SymfonyStyle.php
Asks a question.
SymfonyStyle::askHidden in vendor/symfony/console/Style/SymfonyStyle.php
Asks a question with the user input hidden.
SymfonyStyle::choice in vendor/symfony/console/Style/SymfonyStyle.php
Asks a choice question.
SymfonyStyle::confirm in vendor/symfony/console/Style/SymfonyStyle.php
Asks for confirmation.

File

vendor/symfony/console/Style/SymfonyStyle.php, line 296

Class

SymfonyStyle
Output decorator helpers for the Symfony Style Guide.

Namespace

Symfony\Component\Console\Style

Code

public function askQuestion(Question $question) : mixed {
    if ($this->input
        ->isInteractive()) {
        $this->autoPrependBlock();
    }
    $this->questionHelper ??= new SymfonyQuestionHelper();
    $answer = $this->questionHelper
        ->ask($this->input, $this, $question);
    if ($this->input
        ->isInteractive()) {
        if ($this->output instanceof ConsoleSectionOutput) {
            // add the new line of the `return` to submit the input to ConsoleSectionOutput, because ConsoleSectionOutput is holding all it's lines.
            // this is relevant when a `ConsoleSectionOutput::clear` is called.
            $this->output
                ->addNewLineOfInputSubmit();
        }
        $this->newLine();
        $this->bufferedOutput
            ->write("\n");
    }
    return $answer;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal