@@ -24,8 +24,7 @@ discard block |
||
| 24 | 24 | { |
| 25 | 25 | $this->elementValidation = $validation; |
| 26 | 26 | $this->errorFormatter = is_callable($errorFormatter) ? |
| 27 | - $errorFormatter : |
|
| 28 | - function ($key, $resultMessages, $validationMessages) { |
|
| 27 | + $errorFormatter : function($key, $resultMessages, $validationMessages) { |
|
| 29 | 28 | $resultMessages[$key] = $validationMessages; |
| 30 | 29 | |
| 31 | 30 | return $resultMessages; |
@@ -56,10 +55,10 @@ discard block |
||
| 56 | 55 | foreach ($data as $key => $element) { |
| 57 | 56 | $result = $result->join( |
| 58 | 57 | $this->elementValidation->validate($data[$key], $context), |
| 59 | - function ($a, $b) { |
|
| 58 | + function($a, $b) { |
|
| 60 | 59 | return $a; |
| 61 | 60 | }, |
| 62 | - function ($resultMessages, $validationMessages) use ($key, $errorFormatter) { |
|
| 61 | + function($resultMessages, $validationMessages) use ($key, $errorFormatter) { |
|
| 63 | 62 | return $errorFormatter($key, $resultMessages, $validationMessages); |
| 64 | 63 | } |
| 65 | 64 | ); |
@@ -30,7 +30,6 @@ |
||
| 30 | 30 | public function translate(string $string): string |
| 31 | 31 | { |
| 32 | 32 | return array_key_exists($string, $this->dictionary) ? |
| 33 | - $this->dictionary[$string] : |
|
| 34 | - $string; |
|
| 33 | + $this->dictionary[$string] : $string; |
|
| 35 | 34 | } |
| 36 | 35 | } |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | public function join(self $that, callable $joinValid, callable $joinErrors): self |
| 45 | 45 | { |
| 46 | - if (! $this->isValid || ! $that->isValid) { |
|
| 46 | + if (!$this->isValid || !$that->isValid) { |
|
| 47 | 47 | return self::errors($joinErrors($this->messages, $that->messages)); |
| 48 | 48 | } |
| 49 | 49 | |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | callable $processValid, |
| 73 | 73 | callable $processErrors |
| 74 | 74 | ) { |
| 75 | - if (! $this->isValid) { |
|
| 75 | + if (!$this->isValid) { |
|
| 76 | 76 | return $processErrors($this->messages); |
| 77 | 77 | } |
| 78 | 78 | |
@@ -86,10 +86,10 @@ discard block |
||
| 86 | 86 | public function map(callable $map): self |
| 87 | 87 | { |
| 88 | 88 | return $this->process( |
| 89 | - function ($validContent) use ($map) { |
|
| 89 | + function($validContent) use ($map) { |
|
| 90 | 90 | return self::valid($map($validContent)); |
| 91 | 91 | }, |
| 92 | - function ($messages) { |
|
| 92 | + function($messages) { |
|
| 93 | 93 | return self::errors($messages); |
| 94 | 94 | } |
| 95 | 95 | ); |
@@ -98,10 +98,10 @@ discard block |
||
| 98 | 98 | public function mapErrors(callable $map): self |
| 99 | 99 | { |
| 100 | 100 | return $this->process( |
| 101 | - function ($validContent) { |
|
| 101 | + function($validContent) { |
|
| 102 | 102 | return self::valid($validContent); |
| 103 | 103 | }, |
| 104 | - function (array $messages) use ($map) { |
|
| 104 | + function(array $messages) use ($map) { |
|
| 105 | 105 | return self::errors($map($messages)); |
| 106 | 106 | } |
| 107 | 107 | ); |
@@ -17,8 +17,7 @@ |
||
| 17 | 17 | $this->isAsAsserted = IsAsAsserted::withAssertionAndErrorFormatter( |
| 18 | 18 | 'is_callable', |
| 19 | 19 | is_callable($errorFormatter) ? |
| 20 | - $errorFormatter : |
|
| 21 | - function ($data) { |
|
| 20 | + $errorFormatter : function($data) { |
|
| 22 | 21 | return [self::NOT_A_CALLABLE]; |
| 23 | 22 | } |
| 24 | 23 | ); |
@@ -18,8 +18,7 @@ |
||
| 18 | 18 | $this->isAsAsserted = IsAsAsserted::withAssertionAndErrorFormatter( |
| 19 | 19 | 'is_bool', |
| 20 | 20 | is_callable($errorFormatter) ? |
| 21 | - $errorFormatter : |
|
| 22 | - function ($data) { |
|
| 21 | + $errorFormatter : function($data) { |
|
| 23 | 22 | return [self::NOT_A_BOOL]; |
| 24 | 23 | } |
| 25 | 24 | ); |
@@ -18,8 +18,7 @@ |
||
| 18 | 18 | $this->isAsAsserted = IsAsAsserted::withAssertionAndErrorFormatter( |
| 19 | 19 | 'is_array', |
| 20 | 20 | is_callable($errorFormatter) ? |
| 21 | - $errorFormatter : |
|
| 22 | - function ($data) { |
|
| 21 | + $errorFormatter : function($data) { |
|
| 23 | 22 | return [self::NOT_AN_ARRAY]; |
| 24 | 23 | } |
| 25 | 24 | ); |
@@ -18,8 +18,7 @@ |
||
| 18 | 18 | $this->isAsAsserted = IsAsAsserted::withAssertionAndErrorFormatter( |
| 19 | 19 | 'is_int', |
| 20 | 20 | is_callable($errorFormatter) ? |
| 21 | - $errorFormatter : |
|
| 22 | - function ($data) { |
|
| 21 | + $errorFormatter : function($data) { |
|
| 23 | 22 | return [self::NOT_AN_INTEGER]; |
| 24 | 23 | } |
| 25 | 24 | ); |
@@ -18,8 +18,7 @@ |
||
| 18 | 18 | $this->isAsAsserted = IsAsAsserted::withAssertionAndErrorFormatter( |
| 19 | 19 | 'is_object', |
| 20 | 20 | is_callable($errorFormatter) ? |
| 21 | - $errorFormatter : |
|
| 22 | - function ($data) { |
|
| 21 | + $errorFormatter : function($data) { |
|
| 23 | 22 | return [self::NOT_AN_OBJECT]; |
| 24 | 23 | } |
| 25 | 24 | ); |
@@ -18,8 +18,7 @@ |
||
| 18 | 18 | $this->isAsAsserted = IsAsAsserted::withAssertionAndErrorFormatter( |
| 19 | 19 | 'is_iterable', |
| 20 | 20 | is_callable($errorFormatter) ? |
| 21 | - $errorFormatter : |
|
| 22 | - function ($data) { |
|
| 21 | + $errorFormatter : function($data) { |
|
| 23 | 22 | return [self::NOT_AN_ITERABLE]; |
| 24 | 23 | } |
| 25 | 24 | ); |