webmozarts/assert
在 GitHub 查看Feature Request: Check that multiple specific keys exist in an array
Open
#258 创建于 2021年10月28日
help wanted
仓库指标
- Star
- (7,454 star)
- PR 合并指标
- (平均合并 5天 16小时) (30 天内合并 1 个 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.