Skip to content
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

Validating array keys #143

Open
rick-nu opened this issue Aug 5, 2016 · 1 comment
Open

Validating array keys #143

rick-nu opened this issue Aug 5, 2016 · 1 comment
Labels

Comments

@rick-nu
Copy link

rick-nu commented Aug 5, 2016

What

In #116 @camcima presented a way to make array keys testable. With the given PR, array keys are converted into a value in the array, which then becomes testable the regular way. Thus, a key value "magically" appears in your data array.

We need to think if there is a better solution for this. For example if it would be possible to:

$v->required('products')->each(function (Validator $validator) {
    $validator->key()->regex('/^SKU\d{4}\-\d{3}/');
    $validator->required('price')->integer();
    $validator->required('quantity')->integer;
});

This issue is open to suggestions and pull requests.

@nesl247
Copy link

nesl247 commented Mar 27, 2019

Any update on this? I just went to use the validator in a new project and realized this isn't currently possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants