@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | return $this->ruleSets[] = ValidationSet::forField($field); |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - public function field(string $field, Validation|ValidationSet ...$rules): self |
|
| 30 | + public function field(string $field, Validation | ValidationSet ...$rules): self |
|
| 31 | 31 | { |
| 32 | 32 | $this->ruleSet($field)->add(...$rules); |
| 33 | 33 | return $this; |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | * @return static |
| 113 | 113 | * @throws ReflectionException if the class does not exist |
| 114 | 114 | */ |
| 115 | - public static function fromProperties(string|object $objectOrClass, ?int $filter = null): self |
|
| 115 | + public static function fromProperties(string | object $objectOrClass, ?int $filter = null): self |
|
| 116 | 116 | { |
| 117 | 117 | $instance = new self; |
| 118 | 118 | $instance->ruleSets = ValidationSet::fromProperties($objectOrClass, $filter); |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | private SplObjectStorage $rules; |
| 25 | 25 | |
| 26 | - final public function __construct(?string $field = null, Validation|ValidationSet ...$rules) |
|
| 26 | + final public function __construct(?string $field = null, Validation | ValidationSet ...$rules) |
|
| 27 | 27 | { |
| 28 | 28 | $this->rules = new SplObjectStorage(); |
| 29 | 29 | $this->setField($field); |
@@ -35,17 +35,17 @@ discard block |
||
| 35 | 35 | return new self; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - public static function forField(string $field, Validation|ValidationSet ...$rules): self |
|
| 38 | + public static function forField(string $field, Validation | ValidationSet ...$rules): self |
|
| 39 | 39 | { |
| 40 | 40 | return new self($field, ...$rules); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - public static function withRules(Validation|ValidationSet ...$rules): self |
|
| 43 | + public static function withRules(Validation | ValidationSet ...$rules): self |
|
| 44 | 44 | { |
| 45 | 45 | return new self(null, ...$rules); |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - public function add(Validation|ValidationSet ...$rules): self |
|
| 48 | + public function add(Validation | ValidationSet ...$rules): self |
|
| 49 | 49 | { |
| 50 | 50 | foreach ($rules as $rule) { |
| 51 | 51 | if ($rule instanceof Validation) { |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | return $this; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - public function validate(mixed $input, array $context = []): ValidationResult|ValidationResultByField |
|
| 63 | + public function validate(mixed $input, array $context = []): ValidationResult | ValidationResultByField |
|
| 64 | 64 | { |
| 65 | 65 | $violations = $empty = $this->newEmptyValidationResult(); |
| 66 | 66 | if (null === $input && $this->allowsNull()) { |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | * @return ValidationSet[] |
| 150 | 150 | * @throws ReflectionException if the class does not exist |
| 151 | 151 | */ |
| 152 | - public static function fromProperties(string|object $objectOrClass, ?int $filter = null): array |
|
| 152 | + public static function fromProperties(string | object $objectOrClass, ?int $filter = null): array |
|
| 153 | 153 | { |
| 154 | 154 | $ruleSets = []; |
| 155 | 155 | foreach ((new ReflectionClass($objectOrClass))->getProperties($filter) as $property) { |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | * @return ValidationSet[] |
| 166 | 166 | * @throws ReflectionException |
| 167 | 167 | */ |
| 168 | - public static function fromMethods(string|object $objectOrClass, ?int $filter = null): array |
|
| 168 | + public static function fromMethods(string | object $objectOrClass, ?int $filter = null): array |
|
| 169 | 169 | { |
| 170 | 170 | $ruleSets = []; |
| 171 | 171 | foreach ((new ReflectionClass($objectOrClass))->getMethods($filter) as $method) { |
@@ -181,12 +181,12 @@ discard block |
||
| 181 | 181 | * @return static |
| 182 | 182 | * @throws ReflectionException if the class or property does not exist. |
| 183 | 183 | */ |
| 184 | - public static function fromProperty(string|object $objectOrClass, string $property): self |
|
| 184 | + public static function fromProperty(string | object $objectOrClass, string $property): self |
|
| 185 | 185 | { |
| 186 | 186 | return self::fromReflectionProperty(new ReflectionProperty($objectOrClass, $property)); |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | - public static function fromMethod(string|object $objectOrClass, string $method): self |
|
| 189 | + public static function fromMethod(string | object $objectOrClass, string $method): self |
|
| 190 | 190 | { |
| 191 | 191 | return self::fromReflectionMethod(new ReflectionMethod($objectOrClass, $method)); |
| 192 | 192 | } |