Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature #31466 [Validator] add Validation::createCallable() (janverni…
…euwe) This PR was merged into the 5.1-dev branch. Discussion ---------- [Validator] add Validation::createCallable() | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | This is an initial PR to check/discuss the implementation of a callable validator. If there is interest in merging this, I will gladly update the docs and such. The use case is mainly for validation of console questions, since the default validation has been removed in the latest version and i could not find an easy solution to replace it (if there already is some solution for this, i'm not aware of it) and the question helper uses callables. This small class allows the standard symfony validators to be used in console questions, or any other location that requires a callable validator. Example use case: ```php $io = new SymfonyStyle($input, $output); $required = new CallableValidator([new NotBlank()]); $wsdl = $io->ask('Wsdl location (URL or path to file)', null, $required); ``` As said before, this is by no means the final version, but I would like to know if there is interest in merging this (and receive some feedback about the implementation) before I put any more effort into this. Commits ------- 2e4f2ac [Validator] add Validation::createCallable()
- Loading branch information