Skip to content

Improve violation path on assert message when validating arrays#3

Merged
andrepimpao merged 1 commit into1.xfrom
FV-1-fix-name-on-assert-message
Apr 1, 2025
Merged

Improve violation path on assert message when validating arrays#3
andrepimpao merged 1 commit into1.xfrom
FV-1-fix-name-on-assert-message

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