From f1aebe8a0225a94a8957f69ba9510725beb3a21e Mon Sep 17 00:00:00 2001 From: Victor Westerlund Date: Wed, 17 Jan 2024 12:07:27 +0100 Subject: [PATCH] feat(doc): add strict mode to README --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 200108d..70d30f0 100644 --- a/README.md +++ b/README.md @@ -106,10 +106,20 @@ Error --| [`Error::VALUE_MIN_ERROR`](#min) [`Error::VALUE_MAX_ERROR`](#max) +[`Error::UNKNOWN_PROPERTY_NAME`](#strict-mode) [`Error::INVALID_PROPERTY_TYPE`](#type) [`Error::INVALID_PROPERTY_VALUE`](#typeenum) [`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 The following methods can be chained onto a `Rules` instance to enforce certain constraints on a particular property