webmozarts/assert
Ver no GitHubFeature Request: Check that multiple specific keys exist in an array
Open
#258 aberto em 28 de out. de 2021
help wanted
Métricas do repositório
- Stars
- (7.454 stars)
- Métricas de merge de PR
- (Mesclagem média 5d 16h) (1 fundiu PR em 30d)
Description
Whats about adding assertions for multiple array key existence.
Assert::keysExists(array $value, array $keys)
Check if all of provided key are presented in array
May be useful for validation of POST/PUT request where requester must provide entire object.
Assert::oneOfKeysExists(array $value, array $keys)
Check if at least one of provided key are presented in array
May be useful for validation of PATCH request where all fields can be optional but at least one must be provided.