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

Breadcrumb

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

function StrictConfirmationQuestion::__construct

Constructor.s

Parameters

string $question The question to ask to the user:

bool $default The default answer to return, true or false:

non-empty-string $trueAnswerRegex A regex to match the "yes" answer:

non-empty-string $falseAnswerRegex A regex to match the "no" answer:

Overrides Question::__construct

File

vendor/composer/composer/src/Composer/Question/StrictConfirmationQuestion.php, line 41

Class

StrictConfirmationQuestion
Represents a yes/no question Enforces strict responses rather than non-standard answers counting as default Based on Symfony\Component\Console\Question\ConfirmationQuestion

Namespace

Composer\Question

Code

public function __construct(string $question, bool $default = true, string $trueAnswerRegex = '/^y(?:es)?$/i', string $falseAnswerRegex = '/^no?$/i') {
    parent::__construct($question, $default);
    $this->trueAnswerRegex = $trueAnswerRegex;
    $this->falseAnswerRegex = $falseAnswerRegex;
    $this->setNormalizer($this->getDefaultNormalizer());
    $this->setValidator($this->getDefaultValidator());
}
RSS feed
Powered by Drupal