@@ -16,11 +16,11 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | trait RuleChain |
| 18 | 18 | { |
| 19 | - abstract public function add(Rule|RuleSet ...$rules): static; |
|
| 19 | + abstract public function add(Rule | RuleSet ...$rules): static; |
|
| 20 | 20 | |
| 21 | 21 | public function __call($name, $arguments): static |
| 22 | 22 | { |
| 23 | - $namespace = __NAMESPACE__ . '\\Rules'; |
|
| 23 | + $namespace = __NAMESPACE__.'\\Rules'; |
|
| 24 | 24 | $class = sprintf("%s\%s", $namespace, ucfirst($name)); |
| 25 | 25 | if (!class_exists($class)) { |
| 26 | 26 | throw new RuntimeException(sprintf('Rule not found: (%s).', $name)); |
@@ -37,8 +37,7 @@ |
||
| 37 | 37 | |
| 38 | 38 | $exception = |
| 39 | 39 | $validationException instanceof ValidationExceptionInterface ? |
| 40 | - $validationException : |
|
| 41 | - new ValidationException(); |
|
| 40 | + $validationException : new ValidationException(); |
|
| 42 | 41 | |
| 43 | 42 | $field = $result instanceof ResultByField ? $result->getField() : null; |
| 44 | 43 | foreach ($result->getErrors() as $error) { |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | } |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - return $this->getMessage() . ":" . PHP_EOL . implode(PHP_EOL, $messages); |
|
| 21 | + return $this->getMessage().":".PHP_EOL.implode(PHP_EOL, $messages); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | /** |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | /** |
| 40 | 40 | * @throws Exception\ValidationExceptionInterface |
| 41 | 41 | */ |
| 42 | - public static function forField(string $field, Rule|RuleSet ...$rules): self |
|
| 42 | + public static function forField(string $field, Rule | RuleSet ...$rules): self |
|
| 43 | 43 | { |
| 44 | 44 | return new self($field, ...$rules); |
| 45 | 45 | } |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | /** |
| 48 | 48 | * @throws Exception\ValidationExceptionInterface |
| 49 | 49 | */ |
| 50 | - public static function withRules(Rule|RuleSet ...$rules): self |
|
| 50 | + public static function withRules(Rule | RuleSet ...$rules): self |
|
| 51 | 51 | { |
| 52 | 52 | return new self(null, ...$rules); |
| 53 | 53 | } |
@@ -42,11 +42,10 @@ |
||
| 42 | 42 | /** |
| 43 | 43 | * @throws ValidationExceptionInterface |
| 44 | 44 | */ |
| 45 | - private function newEmptyValidationResult(): ValidationResult|ValidationResultByField |
|
| 45 | + private function newEmptyValidationResult(): ValidationResult | ValidationResultByField |
|
| 46 | 46 | { |
| 47 | 47 | return |
| 48 | 48 | $this->belongsToField() ? |
| 49 | - new ValidationResultByField($this->getField()) : |
|
| 50 | - ValidationResult::everythingIsOk(); |
|
| 49 | + new ValidationResultByField($this->getField()) : ValidationResult::everythingIsOk(); |
|
| 51 | 50 | } |
| 52 | 51 | } |