@@ -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 | ); |
@@ -18,8 +18,7 @@ |
||
| 18 | 18 | $this->isAsAsserted = IsAsAsserted::withAssertionAndErrorFormatter( |
| 19 | 19 | 'is_string', |
| 20 | 20 | is_callable($errorFormatter) ? |
| 21 | - $errorFormatter : |
|
| 22 | - function ($data) { |
|
| 21 | + $errorFormatter : function($data) { |
|
| 23 | 22 | return [self::NOT_A_STRING]; |
| 24 | 23 | } |
| 25 | 24 | ); |
@@ -18,8 +18,7 @@ |
||
| 18 | 18 | $this->isAsAsserted = IsAsAsserted::withAssertionAndErrorFormatter( |
| 19 | 19 | 'is_resource', |
| 20 | 20 | is_callable($errorFormatter) ? |
| 21 | - $errorFormatter : |
|
| 22 | - function ($data) { |
|
| 21 | + $errorFormatter : function($data) { |
|
| 23 | 22 | return [self::NOT_A_RESOURCE]; |
| 24 | 23 | } |
| 25 | 24 | ); |
@@ -16,8 +16,7 @@ |
||
| 16 | 16 | $this->isAsAsserted = IsAsAsserted::withAssertionAndErrorFormatter( |
| 17 | 17 | 'is_array', |
| 18 | 18 | is_callable($errorFormatter) ? |
| 19 | - $errorFormatter : |
|
| 20 | - function ($data) { |
|
| 19 | + $errorFormatter : function($data) { |
|
| 21 | 20 | return [self::NOT_AN_ARRAY]; |
| 22 | 21 | } |
| 23 | 22 | ); |
@@ -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 | ]; |
@@ -28,8 +28,7 @@ discard block |
||
| 28 | 28 | { |
| 29 | 29 | $this->pattern = $pattern; |
| 30 | 30 | $this->errorFormatter = is_callable($errorFormatter) ? |
| 31 | - $errorFormatter : |
|
| 32 | - function (string $key, $data) { |
|
| 31 | + $errorFormatter : function(string $key, $data) { |
|
| 33 | 32 | return [self::MATCH_FAILED]; |
| 34 | 33 | }; |
| 35 | 34 | } |
@@ -48,7 +47,7 @@ discard block |
||
| 48 | 47 | { |
| 49 | 48 | return new self( |
| 50 | 49 | $pattern, |
| 51 | - function (string $key, $data) use ($translator) { |
|
| 50 | + function(string $key, $data) use ($translator) { |
|
| 52 | 51 | return [$translator->translate(self::MATCH_FAILED)]; |
| 53 | 52 | } |
| 54 | 53 | ); |
@@ -27,8 +27,7 @@ discard block |
||
| 27 | 27 | { |
| 28 | 28 | $this->assertion = $assertion; |
| 29 | 29 | $this->errorFormatter = is_callable($errorFormatter) ? |
| 30 | - $errorFormatter : |
|
| 31 | - function ($data) { |
|
| 30 | + $errorFormatter : function($data) { |
|
| 32 | 31 | return [self::NOT_AS_ASSERTED]; |
| 33 | 32 | }; |
| 34 | 33 | } |
@@ -47,7 +46,7 @@ discard block |
||
| 47 | 46 | { |
| 48 | 47 | return new self( |
| 49 | 48 | $assertion, |
| 50 | - function ($data) use ($translator) { |
|
| 49 | + function($data) use ($translator) { |
|
| 51 | 50 | return [$translator->translate(self::NOT_AS_ASSERTED)]; |
| 52 | 51 | } |
| 53 | 52 | ); |
@@ -55,7 +54,7 @@ discard block |
||
| 55 | 54 | |
| 56 | 55 | public function validate($data, array $context = []): ValidationResult |
| 57 | 56 | { |
| 58 | - if (! ($this->assertion)($data)) { |
|
| 57 | + if (!($this->assertion)($data)) { |
|
| 59 | 58 | return ValidationResult::errors(($this->errorFormatter)($data)); |
| 60 | 59 | } |
| 61 | 60 | |
@@ -28,8 +28,7 @@ discard block |
||
| 28 | 28 | { |
| 29 | 29 | $this->key = $key; |
| 30 | 30 | $this->errorFormatter = is_callable($errorFormatter) ? |
| 31 | - $errorFormatter : |
|
| 32 | - function (string $key, $data) { |
|
| 31 | + $errorFormatter : function(string $key, $data) { |
|
| 33 | 32 | return [self::MISSING_KEY]; |
| 34 | 33 | }; |
| 35 | 34 | } |
@@ -48,7 +47,7 @@ discard block |
||
| 48 | 47 | { |
| 49 | 48 | return new self( |
| 50 | 49 | $key, |
| 51 | - function (string $key, $data) use ($translator) { |
|
| 50 | + function(string $key, $data) use ($translator) { |
|
| 52 | 51 | return [$translator->translate(self::MISSING_KEY)]; |
| 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 (! array_key_exists($this->key, $data)) { |
|
| 58 | + if (!array_key_exists($this->key, $data)) { |
|
| 60 | 59 | return ValidationResult::errors(($this->errorFormatter)($this->key, $data)); |
| 61 | 60 | } |
| 62 | 61 | |
@@ -27,8 +27,7 @@ discard block |
||
| 27 | 27 | { |
| 28 | 28 | $this->className = $className; |
| 29 | 29 | $this->errorFormatter = is_callable($errorFormatter) ? |
| 30 | - $errorFormatter : |
|
| 31 | - function (string $className, $data) { |
|
| 30 | + $errorFormatter : function(string $className, $data) { |
|
| 32 | 31 | return [self::NOT_AN_INSTANCE]; |
| 33 | 32 | }; |
| 34 | 33 | } |
@@ -47,7 +46,7 @@ discard block |
||
| 47 | 46 | { |
| 48 | 47 | return new self( |
| 49 | 48 | $className, |
| 50 | - function (string $className, $data) use ($translator) { |
|
| 49 | + function(string $className, $data) use ($translator) { |
|
| 51 | 50 | return [$translator->translate(self::NOT_AN_INSTANCE)]; |
| 52 | 51 | } |
| 53 | 52 | ); |
@@ -55,7 +54,7 @@ discard block |
||
| 55 | 54 | |
| 56 | 55 | public function validate($data, array $context = []): ValidationResult |
| 57 | 56 | { |
| 58 | - if (! $data instanceof $this->className) { |
|
| 57 | + if (!$data instanceof $this->className) { |
|
| 59 | 58 | return ValidationResult::errors(($this->errorFormatter)($this->className, $data)); |
| 60 | 59 | } |
| 61 | 60 | |