webmozarts/assert

Feature Request: Check that multiple specific keys exist in an array

Open

#258 aberto em 28 de out. de 2021

Ver no GitHub
 (1 comment) (1 reaction) (0 assignees)PHP (145 forks)batch import
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.

Guia do colaborador