@@ -114,7 +114,7 @@ |
||
114 | 114 | } |
115 | 115 | |
116 | 116 | /** |
117 | - * @param iterable $errors |
|
117 | + * @param ErrorInterface[] $errors |
|
118 | 118 | * |
119 | 119 | * @return void |
120 | 120 | */ |
@@ -66,10 +66,10 @@ discard block |
||
66 | 66 | // 'address1' => 'Dow 1', // missed required parameter |
67 | 67 | 'accepted' => 'false', |
68 | 68 | ]; |
69 | - $this->console('Invalid data (errors)' . PHP_EOL); |
|
69 | + $this->console('Invalid data (errors)'.PHP_EOL); |
|
70 | 70 | $validator->validate($invalidInput); |
71 | 71 | $this->printErrors($validator->getErrors()); |
72 | - $this->console('Invalid data (captures)' . PHP_EOL); |
|
72 | + $this->console('Invalid data (captures)'.PHP_EOL); |
|
73 | 73 | $this->printCaptures($validator->getCaptures()); |
74 | 74 | |
75 | 75 | // Check with valid data |
@@ -82,10 +82,10 @@ discard block |
||
82 | 82 | 'address2' => null, |
83 | 83 | 'accepted' => 'true', |
84 | 84 | ]; |
85 | - $this->console(PHP_EOL . 'Valid data (errors)' . PHP_EOL); |
|
85 | + $this->console(PHP_EOL.'Valid data (errors)'.PHP_EOL); |
|
86 | 86 | $validator->validate($validInput); |
87 | 87 | $this->printErrors($validator->getErrors()); |
88 | - $this->console('Valid data (captures)' . PHP_EOL); |
|
88 | + $this->console('Valid data (captures)'.PHP_EOL); |
|
89 | 89 | $this->printCaptures($validator->getCaptures()); |
90 | 90 | |
91 | 91 | // The output would be |
@@ -133,11 +133,11 @@ discard block |
||
133 | 133 | $context = $error->getMessageContext(); |
134 | 134 | $errorMsg = MessageFormatter::formatMessage('en', $errorMsg, $context !== null ? $context : []); |
135 | 135 | |
136 | - $this->console("$entry failed for `$paramValue` with: $errorMsg" . PHP_EOL); |
|
136 | + $this->console("$entry failed for `$paramValue` with: $errorMsg".PHP_EOL); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | if ($hasErrors === false) { |
140 | - $this->console('No errors' . PHP_EOL); |
|
140 | + $this->console('No errors'.PHP_EOL); |
|
141 | 141 | } |
142 | 142 | } |
143 | 143 | |
@@ -154,11 +154,11 @@ discard block |
||
154 | 154 | $hasCaptures = true; |
155 | 155 | $type = gettype($value); |
156 | 156 | $value = $value instanceof DateTimeInterface ? $value->format(DateTime::ISO8601) : $value; |
157 | - $this->console("`$name` = `$value` ($type)" . PHP_EOL); |
|
157 | + $this->console("`$name` = `$value` ($type)".PHP_EOL); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | if ($hasCaptures === false) { |
161 | - $this->console('No captures' . PHP_EOL); |
|
161 | + $this->console('No captures'.PHP_EOL); |
|
162 | 162 | } |
163 | 163 | } |
164 | 164 |
@@ -36,7 +36,6 @@ |
||
36 | 36 | public static function execute($value, ContextInterface $context): array |
37 | 37 | { |
38 | 38 | return is_array($value) === true ? |
39 | - static::createSuccessReply($value) : |
|
40 | - static::createErrorReply($context, $value, ErrorCodes::IS_ARRAY); |
|
39 | + static::createSuccessReply($value) : static::createErrorReply($context, $value, ErrorCodes::IS_ARRAY); |
|
41 | 40 | } |
42 | 41 | } |
@@ -36,7 +36,6 @@ |
||
36 | 36 | public static function execute($value, ContextInterface $context): array |
37 | 37 | { |
38 | 38 | return is_numeric($value) === true ? |
39 | - static::createSuccessReply($value) : |
|
40 | - static::createErrorReply($context, $value, ErrorCodes::IS_NUMERIC); |
|
39 | + static::createSuccessReply($value) : static::createErrorReply($context, $value, ErrorCodes::IS_NUMERIC); |
|
41 | 40 | } |
42 | 41 | } |
@@ -36,7 +36,6 @@ |
||
36 | 36 | public static function execute($value, ContextInterface $context): array |
37 | 37 | { |
38 | 38 | return is_float($value) === true ? |
39 | - static::createSuccessReply($value) : |
|
40 | - static::createErrorReply($context, $value, ErrorCodes::IS_FLOAT); |
|
39 | + static::createSuccessReply($value) : static::createErrorReply($context, $value, ErrorCodes::IS_FLOAT); |
|
41 | 40 | } |
42 | 41 | } |
@@ -36,7 +36,6 @@ |
||
36 | 36 | public static function execute($value, ContextInterface $context): array |
37 | 37 | { |
38 | 38 | return is_bool($value) === true ? |
39 | - static::createSuccessReply($value) : |
|
40 | - static::createErrorReply($context, $value, ErrorCodes::IS_BOOL); |
|
39 | + static::createSuccessReply($value) : static::createErrorReply($context, $value, ErrorCodes::IS_BOOL); |
|
41 | 40 | } |
42 | 41 | } |
@@ -36,7 +36,6 @@ |
||
36 | 36 | public static function execute($value, ContextInterface $context): array |
37 | 37 | { |
38 | 38 | return is_int($value) === true ? |
39 | - static::createSuccessReply($value) : |
|
40 | - static::createErrorReply($context, $value, ErrorCodes::IS_INT); |
|
39 | + static::createSuccessReply($value) : static::createErrorReply($context, $value, ErrorCodes::IS_INT); |
|
41 | 40 | } |
42 | 41 | } |
@@ -36,7 +36,6 @@ |
||
36 | 36 | public static function execute($value, ContextInterface $context): array |
37 | 37 | { |
38 | 38 | return is_string($value) === true ? |
39 | - static::createSuccessReply($value) : |
|
40 | - static::createErrorReply($context, $value, ErrorCodes::IS_STRING); |
|
39 | + static::createSuccessReply($value) : static::createErrorReply($context, $value, ErrorCodes::IS_STRING); |
|
41 | 40 | } |
42 | 41 | } |
@@ -37,7 +37,6 @@ |
||
37 | 37 | public static function execute($value, ContextInterface $context): array |
38 | 38 | { |
39 | 39 | return $value instanceof DateTimeInterface ? |
40 | - static::createSuccessReply($value) : |
|
41 | - static::createErrorReply($context, $value, ErrorCodes::IS_DATE_TIME); |
|
40 | + static::createSuccessReply($value) : static::createErrorReply($context, $value, ErrorCodes::IS_DATE_TIME); |
|
42 | 41 | } |
43 | 42 | } |
@@ -42,7 +42,7 @@ |
||
42 | 42 | if (is_array($value) === true) { |
43 | 43 | foreach ($value as $key => $mightBeString) { |
44 | 44 | if (is_string($mightBeString) === true || is_numeric($mightBeString) === true) { |
45 | - $result[$key] = (int)$mightBeString; |
|
45 | + $result[$key] = (int) $mightBeString; |
|
46 | 46 | } else { |
47 | 47 | $reply = static::createErrorReply($context, $mightBeString, ErrorCodes::IS_STRING); |
48 | 48 | break; |