No description
  • PHP 99.1%
  • Shell 0.9%
Find a file
Henrique Moody b701fac656
Create ShortCircuit validator and ShortCircuitable interface
This commit introduces a mechanism for validators to return early once
the validation outcome is determined, rather than evaluating all child
validators.

The ShortCircuit validator evaluates validators sequentially and stops
at the first failure, similar to how PHP's && operator works. This is
useful when later validators depend on earlier ones passing, or when
you want only the first error message.

The ShortCircuitCapable interface allows composite validators (AllOf,
AnyOf, OneOf, NoneOf, Each, All) to implement their own short-circuit
logic.

Why "ShortCircuit" instead of "FailFast":

The name "FailFast" was initially considered but proved misleading.
While AllOf stops on failure (fail fast), AnyOf stops on success
(succeed fast), and OneOf stops on the second success. The common
behavior is not about failing quickly, but about returning as soon as
the outcome is determined—which is exactly what short-circuit
evaluation means. This terminology is familiar to developers from
boolean operators (&& and ||), making the behavior immediately
understandable.

Co-authored-by: Alexandre Gomes Gaigalas <alganet@gmail.com>
Assisted-by: Claude Code (Opus 4.5)
2026-02-05 17:32:42 +01:00
.github Change CI Perf to run on schedule, no runs on PRs 2026-01-30 11:45:06 +00:00
bin Enhance LintSpdxCommand with contributor tracking and header normalization 2026-02-03 15:23:20 +01:00
data Introduce REUSE compliance 2026-01-21 06:28:11 +00:00
docs Create ShortCircuit validator and ShortCircuitable interface 2026-02-05 17:32:42 +01:00
LICENSES Introduce REUSE compliance 2026-01-21 06:28:11 +00:00
src Create ShortCircuit validator and ShortCircuitable interface 2026-02-05 17:32:42 +01:00
src-dev Fix SPDX headers in all files 2026-02-03 15:23:23 +01:00
tests Create ShortCircuit validator and ShortCircuitable interface 2026-02-05 17:32:42 +01:00
.gitattributes Update .gitattributes 2026-02-03 16:22:40 +00:00
.gitignore Introduce phpbench benchmarks and profiles 2026-01-12 23:44:38 +00:00
.readthedocs.yaml Improve syntax highlighting in MkDocs pages 2026-01-05 17:54:43 +01:00
aliases.php Add v::format() to check if data is already in a specific format 2026-02-05 16:19:11 +00:00
codecov.yml Use Pest instead of PHPT files 2024-12-16 17:07:47 +01:00
composer.json Improve Documentation 2026-02-01 22:46:48 +00:00
CONTRIBUTING.md Improve Documentation 2026-02-01 22:46:48 +00:00
LICENSE Introduce REUSE compliance 2026-01-21 06:28:11 +00:00
mkdocs.yml Use awesome-pages to customize the menus 2026-01-26 12:26:06 +01:00
phpbench.json.dist Remove mathematical, niche and deprecated validators 2026-01-30 16:08:27 +00:00
phpcs.xml.dist Remove mathematical, niche and deprecated validators 2026-01-30 16:08:27 +00:00
phpstan.neon.dist Create ShortCircuit validator and ShortCircuitable interface 2026-02-05 17:32:42 +01:00
phpunit.xml.dist Remove mathematical, niche and deprecated validators 2026-01-30 16:08:27 +00:00
README.md Update README.md and README.md-linked headline docs 2026-02-01 22:46:02 +00:00
REUSE.toml Refactor CI Workflows 2026-01-28 17:31:37 +00:00

Respect\Validation

Build Status Code Coverage Latest Stable Version Total Downloads License

The most awesome validation engine ever created for PHP.

  • Complex validation made simple: v::numericVal()->positive()->between(1, 255)->isValid($input).
  • Advanced exception handling.
  • More than 150 (fully tested) validators.

Learn More: