/
githubmirror
/
symfony
Обзор
Документация
Войти
/
githubmirror
/
symfony
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
8.2
src/Symfony/Component/Console/Event/QuestionAnsweredEvent.php
45 строк
968 B
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\Event; use Symfony\Contracts\EventDispatcher\Event; /** * Event dispatched when constraint validation is needed for a question. * * @author Robin Chalas <robin.chalas@gmail.com> */ class QuestionAnsweredEvent extends Event { private array $violations = []; public function __construct( public readonly mixed $value, public readonly array $constraints, ) { } public function addViolation(string $message): void { $this->violations[] = $message; } public function getViolations(): array { return $this->violations; } public function hasViolations(): bool { return (bool) $this->violations; } }