You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update DateTimeDiff to generate results with subsequents
Tentatively created a result with subsequents in UndefOr and NullOr
Refactor KeySet rule
Create DateDiff rule
Delete MinAge, MaxAge, and Age rules
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 "all" prefix
Create class alias for old abstract classes
Rename mode "negative" to "inverted"
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
Fix broken documentation links
Rename branch master to main
Nice to have
- [ ] More integration tests for `oneOf`, `allOf` and `each` validator messages.
- [ ] Create `All` rule (similar to `Each` but creates results with subsequents)
- [ ] Create `DateTimeParseable` or (`DateTimeLenient`) rule
- [ ] Increase code coverage to 98%
- [ ] Share credentials for @TheRespectPanda with @alganet
- [ ] Extra documentation for most common support issues
- [ ] Message translation approaches
- [ ] Navigating the messages tree manually
- [ ] Using validators with custom names
- [ ] Expressing boolean algebra
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.
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, newDomainException('Customers must have valid emails'));
v::email()->assert($input, newDomainException('Customers must have valid emails'));
The text was updated successfully, but these errors were encountered:
Are there any of these unfinished items you've listed that would be good for a new contributor to handle? We're using this library, and this 3.0 release looks like it will fix some of the issues we've had with it, so I could probably put some time toward a few issues to help get the release out.
@dmjohnsson23, at the moment it's a bit tricky, because I'm at a phase that I'm myself figuring out how I really want things to work. I got most of the groundwork done, but I'm still seeing how I really want a few rules to work out. Thank you for offering help, though!
@dmjohnsson23, if you (or anyone) could do what I did for Length in #1485 but for Each, Min, and/or Max, that would be very helpful. I've been coding intensely in the past month, I'm gonna take a break until next year, but I will probably be able to review merge requests.
To-dos
Rules
Each
toAll
Each
with subsequents when possibleMax
with subsequents when possibleMin
with subsequents when possibleLength
with subsequents when possibleDateTimeDiff
to generate results with subsequentsUndefOr
andNullOr
KeySet
ruleDateDiff
ruleMinAge
,MaxAge
, andAge
rulesNotOptional
toNotUndef
BetweenExclusive
ruleConsecutive
ruleLazySequence
ruleMax
ruleMin
ruleKeyValue
ruleLength
ruleNullable
toNullOr
Optional
toUndefOr
Max
rule toLessThanOrEqual
Min
rule toGreaterThanOrEqual
Key
rule intoKey
,KeyExists
, andKeyOptional
Property
rule intoProperty
,PropertyExists
, andPropertyOptional
Core
Create class alias for old abstract classesValidator::assert()
ComponentException
extendLogicException
getMessages()
return__self__
setName()
update names, but not IDsOther
master
tomain
Nice to have
Update validation engine
Here are some "problems" I see with the current engine
assert()
andcheck()
means duplication in some cases.Not
) if there are errors. That means that we have limited granularity control.On version 3.0, this won't be possible anymore:
Instead, you would need to do that:
However, because
assert()
andcheck()
will be available only onValidator
, you could do things like that:The text was updated successfully, but these errors were encountered: