@@ -18,11 +18,11 @@ |
||
18 | 18 | */ |
19 | 19 | trait RuleChainTrait |
20 | 20 | { |
21 | - abstract public function add(Rule|RuleSet ...$rules): static; |
|
21 | + abstract public function add(Rule | RuleSet ...$rules): static; |
|
22 | 22 | |
23 | 23 | public function __call($name, $arguments): static |
24 | 24 | { |
25 | - $namespace = __NAMESPACE__ . '\\Rules'; |
|
25 | + $namespace = __NAMESPACE__.'\\Rules'; |
|
26 | 26 | $class = sprintf("%s\%s", $namespace, ucfirst($name)); |
27 | 27 | if (!class_exists($class)) { |
28 | 28 | throw new RuntimeException(sprintf('Rule not found: (%s).', $name)); |
@@ -26,8 +26,7 @@ |
||
26 | 26 | { |
27 | 27 | return |
28 | 28 | $this->isValid($input, $context) ? |
29 | - new ErrorReporting : |
|
30 | - (new ErrorReporting)->addError($this->message, $this, $this->getField()); |
|
29 | + new ErrorReporting : (new ErrorReporting)->addError($this->message, $this, $this->getField()); |
|
31 | 30 | } |
32 | 31 | |
33 | 32 | private function className(): string |
@@ -23,16 +23,14 @@ |
||
23 | 23 | { |
24 | 24 | return |
25 | 25 | self::$userDefinedFactory instanceof ValidationExceptionFactoryInterface ? |
26 | - self::$userDefinedFactory->create($result) : |
|
27 | - $this->defaultException($result); |
|
26 | + self::$userDefinedFactory->create($result) : $this->defaultException($result); |
|
28 | 27 | } |
29 | 28 | |
30 | 29 | private function defaultException(Result $result): ValidationExceptionInterface |
31 | 30 | { |
32 | 31 | return |
33 | 32 | $this->exception instanceof ValidationExceptionInterface ? |
34 | - $this->exception : |
|
35 | - new ValidationException( |
|
33 | + $this->exception : new ValidationException( |
|
36 | 34 | $result->getErrors(), |
37 | 35 | is_string($this->exception) ? $this->exception : '' |
38 | 36 | ); |