Merge branch 'master' into feat/type-enum

This commit is contained in:
Victor Westerlund 2023-11-29 09:09:59 +01:00 committed by GitHub
commit 1f39f31b4c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View file

@ -87,6 +87,13 @@ Rules->type(Type);
Enforce a data type on the request by chaining the `type()` method and passing it one of the available enum [`Type`](#types)s as its argument. Enforce a data type on the request by chaining the `type()` method and passing it one of the available enum [`Type`](#types)s as its argument.
> [!TIP]
> Allow multiple types (union) by chaining multiple `type()` methods
> ```php
> // Example
> Rules->type(Type::NUMBER)->type(Type::NULL);
> ```
### Types ### Types
Type|Description Type|Description
--|-- --|--

View file

@ -90,7 +90,7 @@
$this->add_error($name, "Value must be exactly: {$values}"); $this->add_error($name, "Value must be exactly: {$values}");
} }
$this->add_error($name, "Value must be of type {$types}{$enum_values}"); $this->add_error($name, "Value must be of type {$types}");
} }
if ($rules->min && !$rules->eval_min($value, $scope)) { if ($rules->min && !$rules->eval_min($value, $scope)) {