feat(doc): add strict mode to README

This commit is contained in:
Victor Westerlund 2024-01-17 12:07:27 +01:00 committed by GitHub
parent 612bb0f271
commit f1aebe8a02
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -106,10 +106,20 @@ Error
--| --|
[`Error::VALUE_MIN_ERROR`](#min) [`Error::VALUE_MIN_ERROR`](#min)
[`Error::VALUE_MAX_ERROR`](#max) [`Error::VALUE_MAX_ERROR`](#max)
[`Error::UNKNOWN_PROPERTY_NAME`](#strict-mode)
[`Error::INVALID_PROPERTY_TYPE`](#type) [`Error::INVALID_PROPERTY_TYPE`](#type)
[`Error::INVALID_PROPERTY_VALUE`](#typeenum) [`Error::INVALID_PROPERTY_VALUE`](#typeenum)
[`Error::MISSING_REQUIRED_PROPERTY`](#required) [`Error::MISSING_REQUIRED_PROPERTY`](#required)
# Strict mode
Enable strict mode by initializing a Ruleset with the "strict" argument set to `true`.
```php
new Ruleset(strict: true);
```
Strict mode will not allow undefined properties to be set in all configured scopes. If a property exists in `Scope` that hasn't been defined with a `Rules()` instance, a `Errors::UNKNOWN_PROPERTY_NAME` error will be set.
# Available rules # Available rules
The following methods can be chained onto a `Rules` instance to enforce certain constraints on a particular property The following methods can be chained onto a `Rules` instance to enforce certain constraints on a particular property