Skip to content

Improve violation path on assert message when validating arrays #3

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

Merged
merged 1 commit into from
Apr 1, 2025

Conversation

andrepimpao
Copy link
Contributor

As an example, when validating an array with collection and a name was given, the assert message would not display the index in the array where the error occurred.

$input = ['name' => ''];

Validator::collection([
  'name' => Validator::notBlank()->getConstraints()
])->assert($input, name: 'collection');

Would throw the following exception message collection: This value should not be blank..
With the fix, returns collection[name]: This value should not be blank..

@andrepimpao andrepimpao merged commit 8fffe25 into 1.x Apr 1, 2025
3 checks passed
@andrepimpao andrepimpao deleted the FV-1-fix-name-on-assert-message branch April 1, 2025 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant