@@ -14,7 +14,7 @@ |
||
| 14 | 14 | public function validate($data, array $context = []): ValidationResult |
| 15 | 15 | { |
| 16 | 16 | return parent::validateAssertion( |
| 17 | - function ($data) { |
|
| 17 | + function($data) { |
|
| 18 | 18 | return null !== $data; |
| 19 | 19 | }, |
| 20 | 20 | $data, |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | public function validate($data, array $context = []): ValidationResult |
| 15 | 15 | { |
| 16 | 16 | return parent::validateAssertion( |
| 17 | - function ($data) { |
|
| 17 | + function($data) { |
|
| 18 | 18 | return null === $data; |
| 19 | 19 | }, |
| 20 | 20 | $data, |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | public function validate($data, array $context = []): ValidationResult |
| 15 | 15 | { |
| 16 | 16 | return parent::validateAssertion( |
| 17 | - function ($data) { |
|
| 17 | + function($data) { |
|
| 18 | 18 | return !empty($data); |
| 19 | 19 | }, |
| 20 | 20 | $data, |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | public static function withTranslator(Translator $translator): self |
| 31 | 31 | { |
| 32 | - return new static(function ($data) use ($translator) { |
|
| 32 | + return new static(function($data) use ($translator) { |
|
| 33 | 33 | return [$translator->translate(static::MESSAGE)]; |
| 34 | 34 | }); |
| 35 | 35 | } |
@@ -41,8 +41,7 @@ discard block |
||
| 41 | 41 | return IsAsAsserted::withAssertionAndErrorFormatter( |
| 42 | 42 | $assertion, |
| 43 | 43 | is_callable($this->errorFormatter) ? |
| 44 | - $this->errorFormatter : |
|
| 45 | - function ($data) { |
|
| 44 | + $this->errorFormatter : function($data) { |
|
| 46 | 45 | return [static::MESSAGE]; |
| 47 | 46 | } |
| 48 | 47 | )->validate($data, $context); |
@@ -26,8 +26,7 @@ discard block |
||
| 26 | 26 | { |
| 27 | 27 | $this->key = $key; |
| 28 | 28 | $this->errorFormatter = is_callable($errorFormatter) ? |
| 29 | - $errorFormatter : |
|
| 30 | - function (string $key, $data) { |
|
| 29 | + $errorFormatter : function(string $key, $data) { |
|
| 31 | 30 | return [self::PRESENT_KEY]; |
| 32 | 31 | }; |
| 33 | 32 | } |
@@ -46,7 +45,7 @@ discard block |
||
| 46 | 45 | { |
| 47 | 46 | return new self( |
| 48 | 47 | $key, |
| 49 | - function (string $key, $data) use ($translator) { |
|
| 48 | + function(string $key, $data) use ($translator) { |
|
| 50 | 49 | return [$translator->translate(self::PRESENT_KEY)]; |
| 51 | 50 | } |
| 52 | 51 | ); |
@@ -28,8 +28,7 @@ discard block |
||
| 28 | 28 | { |
| 29 | 29 | $this->values = $values; |
| 30 | 30 | $this->errorFormatter = is_callable($errorFormatter) ? |
| 31 | - $errorFormatter : |
|
| 32 | - function ($values, $data) { |
|
| 31 | + $errorFormatter : function($values, $data) { |
|
| 33 | 32 | return [self::NOT_IN_ARRAY]; |
| 34 | 33 | }; |
| 35 | 34 | } |
@@ -48,7 +47,7 @@ discard block |
||
| 48 | 47 | { |
| 49 | 48 | return new self( |
| 50 | 49 | $values, |
| 51 | - function (array $values, $data) use ($translator) { |
|
| 50 | + function(array $values, $data) use ($translator) { |
|
| 52 | 51 | return [$translator->translate(self::NOT_IN_ARRAY)]; |
| 53 | 52 | } |
| 54 | 53 | ); |
@@ -56,7 +55,7 @@ discard block |
||
| 56 | 55 | |
| 57 | 56 | public function validate($data, array $context = []): ValidationResult |
| 58 | 57 | { |
| 59 | - if (! in_array($data, $this->values, true)) { |
|
| 58 | + if (!in_array($data, $this->values, true)) { |
|
| 60 | 59 | return ValidationResult::errors(($this->errorFormatter)($this->values, $data)); |
| 61 | 60 | } |
| 62 | 61 | |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | { |
| 43 | 43 | $translator = $this->translator; |
| 44 | 44 | |
| 45 | - return array_map(function ($message) use ($translator) { |
|
| 45 | + return array_map(function($message) use ($translator) { |
|
| 46 | 46 | if (is_string($message)) { |
| 47 | 47 | return $translator->translate($message); |
| 48 | 48 | } |
@@ -34,8 +34,7 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | $this->validations = $validations; |
| 36 | 36 | $this->errorFormatter = is_callable($errorFormatter) ? |
| 37 | - $errorFormatter : |
|
| 38 | - function (array $messages) { |
|
| 37 | + $errorFormatter : function(array $messages) { |
|
| 39 | 38 | return [ |
| 40 | 39 | self::NOT_EVEN_ONE => $messages |
| 41 | 40 | ]; |
@@ -65,7 +64,7 @@ discard block |
||
| 65 | 64 | { |
| 66 | 65 | return new self( |
| 67 | 66 | $validations, |
| 68 | - function (array $messages) use ($translator) { |
|
| 67 | + function(array $messages) use ($translator) { |
|
| 69 | 68 | return [ |
| 70 | 69 | $translator->translate(self::NOT_EVEN_ONE) => $messages |
| 71 | 70 | ]; |
@@ -83,7 +82,7 @@ discard block |
||
| 83 | 82 | |
| 84 | 83 | return $result |
| 85 | 84 | ->mapErrors($this->errorFormatter) |
| 86 | - ->map(function () use ($data) { |
|
| 85 | + ->map(function() use ($data) { |
|
| 87 | 86 | return $data; |
| 88 | 87 | }); |
| 89 | 88 | } |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | public function validate($data, array $context = []): ValidationResult |
| 44 | 44 | { |
| 45 | 45 | return $this->validation->validate(($this->focus)($data), $context) |
| 46 | - ->map(function () use ($data) { |
|
| 46 | + ->map(function() use ($data) { |
|
| 47 | 47 | return $data; |
| 48 | 48 | }); |
| 49 | 49 | } |