Skip to content

Releases: phly/phly-rule-validation

phly/phly-rule-validation 0.2.0

20 Nov 22:11
0.2.0
Compare
Choose a tag to compare

Added

  • Adds support for PHP 8.3.

  • Adds ValidationResult interface, defining the key, value, validity, and error messages for a validation result.

  • Adds RuleSetValidator interface, defining how to validate a rule set, create a default initial valid result set based on the rule set, and retrieve individual rules from the rule set.

  • Adds the Phly\RuleValidation\RuleSet\Options interface.

  • Adds the Phly\RuleValidation\RuleSet\RuleSetOptions implementation.

  • Adds the Phly\RuleValidation\Result\NestedResult class, defining a result that has a ResultSet as a value.

  • Adds comprehensive documentation.

Changed

  • The Rule interface:
    • adds:
      • a missing(): ValidationResult method.
    • modifies:
      • default(); it now returns a ValidationResult instance.
      • key(); it now expects a non-empty-string.
      • validate(); it now returns a ValidationResult instance, and requires $context to have non-empty-string keys.
  • Renames BooleanRule to Phly\RuleValidation\Rule\BooleanRule, and updates it to the new Rule requirements.
  • Renames CallbackRule to Phly\RuleValidation\Rule\CallbackRule, and updates it to the new Rule requirements.
  • The RuleSet class:
    • Renames RuleSet to Phly\RuleValidation\RuleSet\RuleSet.
    • Now implements RuleSetValidator.
    • Is now idempotent; there is no addRule() method.
    • The only ways to create an instance are now __construct(Options $options) and createWithRules(Rule ...$rules).
    • It is no longer iterable.
    • getRuleForKey() is renamed to getRule().
    • It adds __isset() and __get() implementations for access to named rules.
  • The ResultSet class:
    • Now implements Countable.
    • Is now idempotent; there is no add() method. All results must be provided to the constructor.
    • All methods are now marked final. Extension only allows providing property type hints for the purpose of providing hints for composed validation results.

phly/phly-rule-validation 0.1.1

10 Nov 15:17
0.1.1
d7bfc57
Compare
Choose a tag to compare

Added

Adds a __get() implementation to ResultSet to allow pulling composed Result instances via direct property access.

phly/phly-rule-validation 0.1.0

09 Nov 22:01
0.1.0
Compare
Choose a tag to compare

Initial stable release.