No description
  • PHP 99.1%
  • Shell 0.9%
Find a file
Henrique Moody 1915b6fff7
Use paths to identify when a rule fails
When nested-structural validation fails, it's challenging to identify
which rule failed from the main exception message. A great example is
the `Issue796Test.php` file. The exception message says:

host must be a string

But you're left unsure whether it's the `host` key from the `mysql` key
or the `postgresql` key.

This commit changes that behaviour by introducing the concept of "Path."
The `path` represents the path that a rule has taken, and we can use it
in structural rules to identify the path of an array or object.

Here's what it looks like before and after:

```diff
-host must be a string
+`.mysql.host` must be a string
```

Because paths are a specific concept, I added a dot (`.`) at the
beginning of all paths when displaying them. I was inspired by the `jq`
syntax. I also added backticks around paths to distinguish them from any
other value.

I didn't manage to fix a test, and I skipped it instead of fixing it
because I want to make changes in how we display error messages as
arrays, and it will be easier to fix it then.
2024-12-27 23:28:35 +01:00
.github Use Pest instead of PHPT files 2024-12-16 17:07:47 +01:00
bin Handle names via the Named rule 2024-12-26 23:10:19 +01:00
data/domain/public-suffix Update Regional Information 2024-03-25 18:43:50 +01:00
docs Update some templates and improve tests 2024-12-27 15:55:55 +01:00
library Use paths to identify when a rule fails 2024-12-27 23:28:35 +01:00
tests Use paths to identify when a rule fails 2024-12-27 23:28:35 +01:00
.docheader Use SPDX IDs for licensing 2023-02-19 00:19:10 -03:00
.gitattributes Update list of files to be exported by Git 2020-07-29 10:35:36 +02:00
.gitignore Upgrade "phpunit/phpunit" 2024-01-28 14:16:52 +01:00
.readthedocs.yaml Create Read the Docs configuration file 2024-01-28 21:50:01 +01:00
CHANGELOG.md Check if property is initialized before getting its value 2024-01-27 20:36:01 +01:00
codecov.yml Use Pest instead of PHPT files 2024-12-16 17:07:47 +01:00
composer.json Use Pest instead of PHPT files 2024-12-16 17:07:47 +01:00
CONTRIBUTING.md Rename "Validatable" to "Rule" 2024-12-05 19:32:14 +01:00
LICENSE Dusting off. See CHANGELOG.md for more details on this commit 2023-02-13 03:59:11 -03:00
mkdocs.yml Create MkDocs configuration file 2018-12-11 09:25:41 +01:00
phpcs.xml.dist Use Pest instead of PHPT files 2024-12-16 17:07:47 +01:00
phpstan.neon.dist Make mixins smarter and with a shorter name 2024-12-18 19:54:44 +01:00
phpunit.xml.dist Use Pest instead of PHPT files 2024-12-16 17:07:47 +01:00
README.md Improve the "Feature Guide" documentation 2024-12-05 00:21:34 +01:00

Respect\Validation

Build Status Code Coverage Latest Stable Version Total Downloads License

The most awesome validation engine ever created for PHP.

Learn More: