webmozarts/assert

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

開放

#258 建立於 2021年10月28日

 (1 則留言) (1 個反應) (0 位負責人)PHP (145 個分叉)batch import
help wanted

倉庫指標

星標
 (7,454 顆星)
PR 合併指標
 (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.

貢獻者指南