/
githubmirror
/
symfony
Обзор
Документация
Войти
/
githubmirror
/
symfony
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
8.2
src/Symfony/Component/Console/Question/FileQuestion.php
46 строк
1 KB
Robin Chalas
[Console] Allow passing Validator constraints to QuestionHelper and #[Ask]
12 фев 2026, 11:05
Не верифицирован
12 фев 2026, 11:05
f81cc9c
Код
Авторство
О чём код?
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Question; use Symfony\Component\Console\Exception\InvalidArgumentException; /** * Represents a question that accepts file input (paste or path). * * @author Robin Chalas <robin.chalas@gmail.com> */ class FileQuestion extends Question { public function __construct( string $question, private bool $allowPaste = true, private bool $allowPath = true, ) { parent::__construct($question); if (!$allowPaste && !$allowPath) { throw new InvalidArgumentException('At least one of allowPaste or allowPath must be true.'); } $this->setTrimmable(false); } public function isPasteAllowed(): bool { return $this->allowPaste; } public function isPathAllowed(): bool { return $this->allowPath; } }