Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Roadmap to 3.0 #1447

Open
32 of 51 tasks
henriquemoody opened this issue Feb 9, 2024 · 1 comment
Open
32 of 51 tasks

Roadmap to 3.0 #1447

henriquemoody opened this issue Feb 9, 2024 · 1 comment
Milestone

Comments

@henriquemoody
Copy link
Member

henriquemoody commented Feb 9, 2024

NOTE: I will be away until mid-April. Things are very busy at work at the moment, so I will have to pause working in this release for a little while.


To-dos

Rules

  • Create All rule (similar to Each but creates results with siblings)
  • Create DateDiff rule
  • Create DateTimeParseable or (DateTimeLenient) rule
  • Delete MinAge, MaxAge, and Age rules
  • Refactor KeySet rule
  • Tentatively created a result with siblings in UndefOr and NullOr
  • Do not allow rules with children to be used as sibling
  • Rename NotOptional to NotUndef
  • Create BetweenExclusive rule
  • Create Consecutive rule
  • Create LazySequence rule
  • Create a new Max rule
  • Create a new Min rule
  • Create aliases for deprecated/removed rules
  • Delete KeyValue rule
  • Do not use When as a sibling
  • Refactor Length rule
  • Rename Nullable to NullOr
  • Rename Optional to UndefOr
  • Rename Max rule to LessThanOrEqual
  • Rename Min rule to GreaterThanOrEqual
  • Rename the "Attribute" rule to "Property"
  • Split the Key rule into Key, KeyExists, and KeyOptional
  • Split the Property rule into Property, PropertyExists, and PropertyOptional

Core

  • Create class alias for old abstract classes
  • More integration tests for oneOf, allOf and each validator messages.
  • Rename mode "negative" to "inverted"
  • Create "all" prefix
  • Add second parameter to Validator::assert()
  • Create "key" prefix
  • Create "length" prefix
  • Create "max" prefix
  • Create "min" prefix
  • Create "nullOr" prefix
  • Create "property" prefix
  • Create "undefOr" prefix
  • Make ComponentException extend LogicException
  • Make getMessages() return __self__
  • Make setName() update names, but not IDs
  • Prefix ids when working with sibling results
  • Update validation engine (todo: split into different tasks)
  • Use PHP Attributes to define templates

Other

  • Increase code coverage to 98%
  • Get my credentials for @TheRespectPanda accounts in order
  • Fix broken documentation links
  • Extra documentation for most common support issues
    • Message translation approaches
    • Navigating the messages tree manually
    • Using validators with custom names
    • Expressing boolean algebra
  • Rename branch master to main

Update validation engine

Here are some "problems" I see with the current engine

  • Allowing each rule to execute assert() and check() means duplication in some cases.
  • Because we use exceptions to assert/check, we can only invert a validation (with Not) if there are errors. That means that we have limited granularity control.
  • There is a lot of logic in the exceptions. That means that even after an exception is thrown, something could still happen. We're stable on that front, but I want to simplify them. Besides, debugging exception code is painful because the stack track stops once the exception constructor is created.

On version 3.0, this won't be possible anymore:

$email = new Email():
$email->assert($input);

Instead, you would need to do that:

$validator = new Validator(new Email());
$validator->assert($input);

However, because assert() and check() will be available only on Validator, you could do things like that:

// Passing the template as a string
v::email()->check($input, 'Uff... {{input}} should have been an email');

// Passing an array of templates
v::intValue()->positive()->lessThan(5)->assert($input, [
    'intValue' => 'Area must be an integer',
    'positive' => 'Area must be a positive number',
    'lessThan' => 'Area cannot be bigger than m2',
]);

// Passing a custom exception
v::email()->check($input, new DomainException('Customers must have valid emails'));
v::email()->assert($input, new DomainException('Customers must have valid emails'));
@henriquemoody henriquemoody added this to the 3.0 milestone Mar 9, 2024
@dmitriiPopov
Copy link

Hello, guys. When will you continue working on release 3.0?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants