Commit graph

9 commits

Author SHA1 Message Date
Henrique Moody
7f66bcea10
Bump PHP support from 8.1 to 8.5
We want to release version 3.0 as fresh as possible, without having to
maintain backward compatibility with the previous versions. Because that
version will be on for some time, we decided it will be best to support
only PHP version 8.5 or higher.

Acked-by: Alexandre Gomes Gaigalas <alganet@gmail.com>
2025-12-18 19:03:38 +01:00
Henrique Moody
0066786fa7
Remove deprecated methods check() and validate()
We want to release version 3.0 as fresh as possible, without having to
maintain backward compatibility with the previous versions.

Acked-by: Alexandre Gomes Gaigalas <alganet@gmail.com>
2025-12-18 17:29:02 +01:00
Henrique Moody
18d8246fa5
Remove duplication and improve naming of adjacent results
I identified a pattern among rules that create results with adjacent
results, so I created a method that abstracts that. I did have to
compromise with the DateTimeDiff, having to escape the input instead of
using the name itself, but that seems like a good trade-off.

I've also renamed "Subsequent" to "Adjacent" because it sounded better.
This is the second time I've renamed this concept, and I hope it will be
the last.
2024-12-20 17:12:11 +01:00
Henrique Moody
7cec227520
Create "Attribute" rule
With this change, any rule can be used as a PHP attribute. I have wanted
to implement this feature for a while, as it allows you to bind the
validation to a specific property and just validate the object
afterwards.
2024-12-13 03:49:29 +01:00
Henrique Moody
1093ab3a65
Handle when "DateTimeImmutable" cannot parse the given date
In some cases, "DateTimeImmutable" will throw an exception because it
cannot parse the date. In those cases, we shouldn't throw an exception,
but instead return a specific result that tells what happened.
2024-12-13 02:40:42 +01:00
Henrique Moody
52e628fc6f
Rename "siblings" to "subsequent"
The name "subsequent" better represents those results. What I would
consider a "sibling" would be another child from the same result.
2024-12-13 02:16:16 +01:00
Henrique Moody
d5cf1311c8
Update DateTimeDiff to generate results with siblings
Since I updated the validation engine[1], it became possible to create
results with siblings. This commit changes the "DateTimeDiff", allowing
it to create a result with a sibling when possible. That will improve
the clarity of the error messages.

While at it, I noticed that we were not translating the type of
interval, so I fixed that and improved the documentation.

[1]: 238f2d506a
2024-12-09 01:31:26 +01:00
Henrique Moody
e6af762fe4
Rename "Validatable" to "Rule"
Besides the interface's name, everything already calls this type "Rule",
not "Validatable." This commit puts a stone on it and renames the
interface for better naming.
2024-12-05 19:32:14 +01:00
Henrique Moody
cf03f8ad5f
Create "DateTimeDiff" rule
Co-authored-by: Gabriel Goulart <vieirabiel2009@hotmail.com>
2024-11-26 18:25:29 +01:00