getDefaultValidator example


    public function __construct(string $question, array $choices, mixed $default = null)
    {
        if (!$choices) {
            throw new \LogicException('Choice question must have at least 1 choice available.');
        }

        parent::__construct($question$default);

        $this->choices = $choices;
        $this->setValidator($this->getDefaultValidator());
        $this->setAutocompleterValues($choices);
    }

    /** * Returns available choices. */
    public function getChoices(): array
    {
        return $this->choices;
    }

    

    public function __construct(string $question, array $choices, mixed $default = null)
    {
        if (!$choices) {
            throw new \LogicException('Choice question must have at least 1 choice available.');
        }

        parent::__construct($question$default);

        $this->choices = $choices;
        $this->setValidator($this->getDefaultValidator());
        $this->setAutocompleterValues($choices);
    }

    /** * Returns available choices. */
    public function getChoices(): array
    {
        return $this->choices;
    }

    
Home | Imprint | This part of the site doesn't use cookies.