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

Assert an array of values is a non-empty, non-associative list of a specific type #288

Open
PHLAK opened this issue Jul 3, 2023 · 0 comments
Labels

Comments

@PHLAK
Copy link

PHLAK commented Jul 3, 2023

I find myself repeating the following assertions often to ensure an array of values is a non-associative list, not empty and all values are of a particular type.

Assert::isNonEmptyList($someValues);
Assert::allIsInstanceOf($someValues, SomeClass::class);

Would there be interest in adding methods to unify this use case to a single method? For example.

Assert::listIsInstanceOf($someValues, SomeClass::class);

// and

Assert::nonEmptyListIsInstanceOf($someValues, SomeClass::class);

If so, I'd gladly work on a PR for this.

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