webmozarts/assert

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

Open

#258 opened on 2021年10月28日

GitHub で見る
 (1 comment) (1 reaction) (0 assignees)PHP (145 forks)batch import
help wanted

Repository metrics

Stars
 (7,454 stars)
PR merge metrics
 (平均マージ 5d 16h) (30d で 1 merged PR)

説明

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.

コントリビューターガイド