Commit graph

11 commits

Author SHA1 Message Date
Henrique Moody
7c681fec66
Fix SPDX headers in all files
I ran the `bin/console spdx --fix` with different strategies for
different files. For most of the core classes, since they've been
drastically rebuilt, I've run it with the `git-blame` strategy, for for
the `src/Validators`, in which the API changed completely but the logic
remains the same, I use the `git-log` strategy.
2026-02-03 15:23:23 +01:00
Henrique Moody
92d53f096d
Rename "Callback" validator to "Satisfies"
The previous name was confusing as it focused on the implementation
detail (receiving a callback) rather than what the validator actually
does. The new name "Satisfies" better conveys the validator's purpose:
checking whether the input satisfies a given condition.

Assisted-by: Claude Code (Opus 4.5)
2026-02-02 01:40:14 +01:00
Alexandre Gomes Gaigalas
d9cdc118b2 Introduce REUSE compliance
This commit introduces REUSE compliance by annotating all files
with SPDX information and placing the reused licences in the
LICENSES folder.

We additionally removed the docheader tool which is made obsolete
by this change.

The main LICENSE and copyright text of the project is now not under
my personal name anymore, and it belongs to "The Respect Project
Contributors" instead.

This change restores author names to several files, giving the
appropriate attribution for contributions.
2026-01-21 06:28:11 +00:00
Henrique Moody
1a2c52079f
Rename Validator to ValidatorBuilder
The `Validator` class implements the Builder patterns, because it builds
a complex validator within a chain. This is a major breaking change, as
the `Validator` class is the foundation of the library. However, that’s
something relatively easy to replace everywhere.
2026-01-05 11:57:40 +01:00
Henrique Moody
daf3d9389d
Change order of arguments in Templated rule
Having the template itself as a first argument makes the rule way more
intuitive. The third parameter is not as used as the first one, so, even
though it's very connected with the template, I thought it was better to
keep it as the third argument.
2026-01-04 15:21:50 +01:00
Henrique Moody
d9380588e7
Remove the setTemplate() method from Validator
The `setTemplate()` method can be confusing, as it can be tricky for
someone to determine which chain is being templated. Using the
`Templated` rule makes this much more explicit and adds a little bit of
verbosity. For users, this will be a significant change, but there are
easy ways to update this code in their projects, so I’m not overly
concerned about it.

Another benefit of this change is that it makes the `Validator` much
simpler, as it no longer needs to track the template. This change also
makes the `Reducer` simpler, for similar reasons to the `Validator`.
However, because the `Validator` is simpler, we can remove the code that
the `Reducer` had to meet the specific needs of the `Validator`.
2026-01-02 15:45:23 +01:00
Henrique Moody
48405271c5
Replace placeholder "name" with "subject"
The `{{name}}` placeholder could represent different things depending on
the state of the Result, and referring to it as `{{name}}` seems
arbitrary. This commit changes it to `{{subject}}`, which is much more
generic and it describes well what that placeholder can mean.
2025-12-26 21:30:01 +01:00
Henrique Moody
cfeb01e89e
Bump respect/coding-standard from 4 to 5 2025-12-18 19:03:39 +01:00
Henrique Moody
d3239e878d
Change how we're writing Pest tests
The problem with the current approach is that the "expect()" calls
happen inside "tests/Pest.php". That means that when something fails, we
can't easily know which exact expectation has failed.

This commit will change the helper functions, and will make the tests
more verbose, but event with that, the developer experience is better.
2025-12-18 14:02:33 +01:00
Henrique Moody
aa633db46a
Improve format of Pest files
I added some trailing commas to the files.
2024-12-22 06:53:36 +01:00
Henrique Moody
94daa8d669
Use Pest instead of PHPT files
Although I love PHPT files, and I've done my fair share of making it
easier to write them in this library, they're very slow, and running
them has become a hindrance.

I've been fidgeting with the idea of using Pest for a while, and I think
it's the right tool for the job. I had to create a couple of functions
to make it easier to run those tests, and now they're working really
alright.

I migrated all the PHPT files into Pest files -- I automated most of the
work with a little script using "nikic/php-parser"; this commit should
contain all the previous PHPT tests as Pest tests.

The previous integration tests would take sixteen seconds, and the Pest
tests take less than a second.
2024-12-16 17:07:47 +01:00