feat(doc): add Type::ENUM to README

This commit is contained in:
Victor Westerlund 2023-11-29 09:03:21 +01:00 committed by GitHub
parent f0377726d5
commit e9a855aed0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -95,8 +95,20 @@ Type|Description
`Type::BOOLEAN`|Value must be a boolean or ([**considered bool for GET rules**](#boolean-coercion-from-string-for-search-parameters)) `Type::BOOLEAN`|Value must be a boolean or ([**considered bool for GET rules**](#boolean-coercion-from-string-for-search-parameters))
`Type::ARRAY`|Value must be a JSON array `Type::ARRAY`|Value must be a JSON array
`Type::OBJECT`|Value must be a JSON object `Type::OBJECT`|Value must be a JSON object
`Type::ENUM`|Value must be exactly one of pre-defined values ([**more information**](#type-enum))
`Type::NULL`|Value must be null or ([**considered null for GET rules**](#null-coercion-from-string-for-search-parameters)) `Type::NULL`|Value must be null or ([**considered null for GET rules**](#null-coercion-from-string-for-search-parameters))
#### `Type::ENUM`
Provided value for property must be an exact match of any value provided as an `array` to the second argument of `type(Type::ENUM, <whitelist>)`
```php
Rules->type(Type::ENUM, [
"FOO",
"BAR"
]);
```
Any value that isn't `"FOO"` or `"BAR"` will be rejected.
#### Boolean coercion from string for search parameters #### Boolean coercion from string for search parameters
Search parameters are read as strings, a boolean is therefor coerced from the following rules. Search parameters are read as strings, a boolean is therefor coerced from the following rules.