Completed
Push — develop ( 042690...c2d572 )
by Neomerx
03:18 queued 01:48
created
src/Rules/Types/AsNumeric.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -47,7 +47,6 @@
 block discarded – undo
47 47
     public static function execute($value, ContextInterface $context): array
48 48
     {
49 49
         return is_numeric($value) === true ?
50
-            BlockReplies::createSuccessReply($value) :
51
-            BlockReplies::createErrorReply($context, $value, ErrorCodes::IS_NUMERIC);
50
+            BlockReplies::createSuccessReply($value) : BlockReplies::createErrorReply($context, $value, ErrorCodes::IS_NUMERIC);
52 51
     }
53 52
 }
Please login to merge, or discard this patch.
src/Rules/Types/AsDateTime.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -48,7 +48,6 @@
 block discarded – undo
48 48
     public static function execute($value, ContextInterface $context): array
49 49
     {
50 50
         return $value instanceof DateTimeInterface ?
51
-            BlockReplies::createSuccessReply($value) :
52
-            BlockReplies::createErrorReply($context, $value, ErrorCodes::IS_DATE_TIME);
51
+            BlockReplies::createSuccessReply($value) : BlockReplies::createErrorReply($context, $value, ErrorCodes::IS_DATE_TIME);
53 52
     }
54 53
 }
Please login to merge, or discard this patch.
src/Blocks/ProcedureBlock.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -128,7 +128,7 @@
 block discarded – undo
128 128
     }
129 129
 
130 130
     /**
131
-     * @param callable|null $endCallable
131
+     * @param callable $endCallable
132 132
      *
133 133
      * @return self
134 134
      */
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     /**
73 73
      * @inheritdoc
74 74
      */
75
-    public function getStartCallable(): ?callable
75
+    public function getStartCallable(): ? callable
76 76
     {
77 77
         return $this->startCallable;
78 78
     }
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
     /**
89 89
      * @inheritdoc
90 90
      */
91
-    public function getEndCallable(): ?callable
91
+    public function getEndCallable(): ? callable
92 92
     {
93 93
         return $this->endCallable;
94 94
     }
Please login to merge, or discard this patch.
src/Contracts/Execution/BlockStateInterface.php 1 patch
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -23,15 +23,15 @@
 block discarded – undo
23 23
 {
24 24
     /**
25 25
      * @param int   $key
26
-     * @param mixed $default
26
+     * @param boolean $default
27 27
      *
28
-     * @return mixed
28
+     * @return ContextInterface
29 29
      */
30 30
     public function getState(int $key, $default = null);
31 31
 
32 32
     /**
33 33
      * @param int   $key
34
-     * @param mixed $value
34
+     * @param boolean $value
35 35
      *
36 36
      * @return self
37 37
      */
Please login to merge, or discard this patch.
src/Rules/Converters/StringToInt.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
     public static function execute($value, ContextInterface $context): array
48 48
     {
49 49
         if (is_string($value) === true || is_numeric($value) === true) {
50
-            return BlockReplies::createSuccessReply((int)$value);
50
+            return BlockReplies::createSuccessReply((int) $value);
51 51
         }
52 52
 
53 53
         return BlockReplies::createErrorReply($context, $value, ErrorCodes::IS_INT);
Please login to merge, or discard this patch.
src/Rules/Converters/StringArrayToIntArray.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@
 block discarded – undo
53 53
         if (is_array($value) === true) {
54 54
             foreach ($value as $key => $mightBeString) {
55 55
                 if (is_string($mightBeString) === true || is_numeric($mightBeString) === true) {
56
-                    $result[$key] = (int)$mightBeString;
56
+                    $result[$key] = (int) $mightBeString;
57 57
                 } else {
58 58
                     $reply = BlockReplies::createErrorReply($context, $mightBeString, ErrorCodes::IS_STRING);
59 59
                     break;
Please login to merge, or discard this patch.
src/Rules/Converters/StringToFloat.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
     public static function execute($value, ContextInterface $context): array
48 48
     {
49 49
         if (is_string($value) === true || is_numeric($value) === true) {
50
-            return BlockReplies::createSuccessReply((float)$value);
50
+            return BlockReplies::createSuccessReply((float) $value);
51 51
         }
52 52
 
53 53
         return BlockReplies::createErrorReply($context, $value, ErrorCodes::IS_FLOAT);
Please login to merge, or discard this patch.
src/Contracts/Blocks/ProcedureBlockInterface.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
     /**
25 25
      * @return callable|null
26 26
      */
27
-    public function getStartCallable(): ?callable;
27
+    public function getStartCallable(): ? callable;
28 28
 
29 29
     /**
30 30
      * @return callable
@@ -34,5 +34,5 @@  discard block
 block discarded – undo
34 34
     /**
35 35
      * @return callable|null
36 36
      */
37
-    public function getEndCallable(): ?callable;
37
+    public function getEndCallable(): ? callable;
38 38
 }
Please login to merge, or discard this patch.
sample/Application.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
      */
61 61
     private function showBasicUsage(): void
62 62
     {
63
-        $this->console('Basic usage sample.' . PHP_EOL);
64
-        $this->console('===================' . PHP_EOL);
63
+        $this->console('Basic usage sample.'.PHP_EOL);
64
+        $this->console('==================='.PHP_EOL);
65 65
 
66 66
         // Let's build a rule that validates an input to be either `null` or a string from 5 to 10 characters.
67 67
         $validator = Validator::validator(
@@ -71,21 +71,21 @@  discard block
 block discarded – undo
71 71
         // let's try validation with valid input
72 72
         $input = null;
73 73
         if ($validator->validate($input) === true) {
74
-            $this->console("Validation OK for `null`." . PHP_EOL);
74
+            $this->console("Validation OK for `null`.".PHP_EOL);
75 75
         } else {
76 76
             assert(false, 'We should not be here.');
77 77
         }
78 78
         // another one
79 79
         $input = 'Hello';
80 80
         if ($validator->validate($input) === true) {
81
-            $this->console("Validation OK for `$input`." . PHP_EOL);
81
+            $this->console("Validation OK for `$input`.".PHP_EOL);
82 82
         } else {
83 83
             assert(false, 'We should not be here.');
84 84
         }
85 85
         // this one should not pass the validation
86 86
         $input = 'This string is too long.';
87 87
         if ($validator->validate($input) === false) {
88
-            $this->console("Input `$input` has not passed validation." . PHP_EOL);
88
+            $this->console("Input `$input` has not passed validation.".PHP_EOL);
89 89
             $this->printErrors($validator->getErrors());
90 90
         } else {
91 91
             assert(false, 'We should not be here.');
@@ -101,9 +101,9 @@  discard block
 block discarded – undo
101 101
             v::isString(v::stringToDateTime(DATE_ATOM, v::between($fromDate, $toDate)))
102 102
                 ->setName('my_date')->enableCapture()
103 103
         );
104
-        $input     = '2001-03-04T05:06:07+08:00';
104
+        $input = '2001-03-04T05:06:07+08:00';
105 105
         if ($validator->validate($input) === true) {
106
-            $this->console("Validation OK for `$input`." . PHP_EOL);
106
+            $this->console("Validation OK for `$input`.".PHP_EOL);
107 107
             $myDate = $validator->getCaptures()->get()['my_date'];
108 108
             // note that captured date is already DateTime
109 109
             assert($myDate instanceof DateTimeInterface);
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
             assert(false, 'We should not be here.');
112 112
         }
113 113
 
114
-        $this->console(PHP_EOL . PHP_EOL . PHP_EOL);
114
+        $this->console(PHP_EOL.PHP_EOL.PHP_EOL);
115 115
 
116 116
         // The output would be
117 117
         // -------------------------------------------------------------------------------------------------------
@@ -130,8 +130,8 @@  discard block
 block discarded – undo
130 130
      */
131 131
     private function showAdvancedUsageWithCustomValidator(): void
132 132
     {
133
-        $this->console('Advanced usage sample.' . PHP_EOL);
134
-        $this->console('===================' . PHP_EOL);
133
+        $this->console('Advanced usage sample.'.PHP_EOL);
134
+        $this->console('==================='.PHP_EOL);
135 135
 
136 136
         // Validation rules for input are
137 137
         // - `email` must be a string and a valid email value (as FILTER_VALIDATE_EMAIL describes)
@@ -152,10 +152,10 @@  discard block
 block discarded – undo
152 152
             'last_name'    => '',
153 153
             'payment_plan' => '123',
154 154
         ];
155
-        $this->console('Invalid data (errors)' . PHP_EOL);
155
+        $this->console('Invalid data (errors)'.PHP_EOL);
156 156
         $validator->validate($invalidInput);
157 157
         $this->printErrors($validator->getErrors());
158
-        $this->console('Invalid data (captures)' . PHP_EOL);
158
+        $this->console('Invalid data (captures)'.PHP_EOL);
159 159
         $this->printCaptures($validator->getCaptures());
160 160
 
161 161
         // Check with valid data
@@ -165,10 +165,10 @@  discard block
 block discarded – undo
165 165
             'last_name'    => null,
166 166
             'payment_plan' => '2',
167 167
         ];
168
-        $this->console(PHP_EOL . 'Valid data (errors)' . PHP_EOL);
168
+        $this->console(PHP_EOL.'Valid data (errors)'.PHP_EOL);
169 169
         $validator->validate($validInput);
170 170
         $this->printErrors($validator->getErrors());
171
-        $this->console('Valid data (captures)' . PHP_EOL);
171
+        $this->console('Valid data (captures)'.PHP_EOL);
172 172
         $this->printCaptures($validator->getCaptures());
173 173
 
174 174
         // The output would be
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
         }
209 209
 
210 210
         if ($hasErrors === false) {
211
-            $this->console('No errors' . PHP_EOL);
211
+            $this->console('No errors'.PHP_EOL);
212 212
         }
213 213
     }
214 214
 
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
         $context    = $error->getMessageContext();
227 227
         $errorMsg   = MessageFormatter::formatMessage('en', $errorMsg, $context !== null ? $context : []);
228 228
 
229
-        $this->console("$entry failed for `$paramValue` with: $errorMsg" . PHP_EOL);
229
+        $this->console("$entry failed for `$paramValue` with: $errorMsg".PHP_EOL);
230 230
     }
231 231
 
232 232
     /**
@@ -241,11 +241,11 @@  discard block
 block discarded – undo
241 241
         foreach ($captures->get() as $name => $value) {
242 242
             $hasCaptures = true;
243 243
             $type        = gettype($value);
244
-            $this->console("`$name` = `$value` ($type)" . PHP_EOL);
244
+            $this->console("`$name` = `$value` ($type)".PHP_EOL);
245 245
         }
246 246
 
247 247
         if ($hasCaptures === false) {
248
-            $this->console('No captures' . PHP_EOL);
248
+            $this->console('No captures'.PHP_EOL);
249 249
         }
250 250
     }
251 251
 
Please login to merge, or discard this patch.