webmozarts/assert

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

Open

#258 geöffnet am 28. Okt. 2021

Auf GitHub ansehen
 (1 Kommentar) (1 Reaktion) (0 zugewiesene Personen)PHP (145 Forks)batch import
help wanted

Repository-Metriken

Stars
 (7.454 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 5T 16h) (1 gemergte PR in 30 T)

Beschreibung

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.

Contributor Guide