Passed
Push — master ( 1d6cd7...f498cd )
by Aleksei
06:14
created
src/SendIt/tests/JobTest.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -75,13 +75,13 @@  discard block
 block discarded – undo
75 75
             ['emails' => ['[email protected]']]
76 76
         );
77 77
 
78
-        try {
78
+        try{
79 79
             $this->getHandler()->handle(
80 80
                 MailQueue::JOB_NAME,
81 81
                 'id',
82 82
                 json_encode(MessageSerializer::pack($this->getMail()))
83 83
             );
84
-        } catch (TransportException $e) {
84
+        }catch (TransportException $e){
85 85
         }
86 86
 
87 87
         $this->logger->mockery_verify();
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
     private function expectRenderer(Email $email): void
99 99
     {
100 100
         $this->renderer->expects('render')->withArgs(
101
-            function (Message $message) {
101
+            function (Message $message){
102 102
                 $this->assertSame($message->getSubject(), 'test');
103 103
                 return true;
104 104
             }
Please login to merge, or discard this patch.
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -75,13 +75,16 @@  discard block
 block discarded – undo
75 75
             ['emails' => ['[email protected]']]
76 76
         );
77 77
 
78
-        try {
78
+        try
79
+        {
79 80
             $this->getHandler()->handle(
80 81
                 MailQueue::JOB_NAME,
81 82
                 'id',
82 83
                 json_encode(MessageSerializer::pack($this->getMail()))
83 84
             );
84
-        } catch (TransportException $e) {
85
+        }
86
+        catch (TransportException $e)
87
+        {
85 88
         }
86 89
 
87 90
         $this->logger->mockery_verify();
@@ -98,7 +101,8 @@  discard block
 block discarded – undo
98 101
     private function expectRenderer(Email $email): void
99 102
     {
100 103
         $this->renderer->expects('render')->withArgs(
101
-            function (Message $message) {
104
+            function (Message $message)
105
+            {
102 106
                 $this->assertSame($message->getSubject(), 'test');
103 107
                 return true;
104 108
             }
Please login to merge, or discard this patch.
src/Prototype/src/Command/InjectCommand.php 2 patches
Braces   +25 added lines, -12 removed lines patch added patch discarded remove patch
@@ -55,7 +55,8 @@  discard block
 block discarded – undo
55 55
     public function perform(): void
56 56
     {
57 57
         $prototyped = $this->locator->getTargetClasses();
58
-        if ($prototyped === []) {
58
+        if ($prototyped === [])
59
+        {
59 60
             $this->writeln('<comment>No prototyped classes found.</comment>');
60 61
 
61 62
             return;
@@ -63,18 +64,23 @@  discard block
 block discarded – undo
63 64
 
64 65
         $targets = [];
65 66
 
66
-        foreach ($prototyped as $class) {
67
+        foreach ($prototyped as $class)
68
+        {
67 69
             $proto = $this->getPrototypeProperties($class, $prototyped);
68
-            if (empty($proto)) {
70
+            if (empty($proto))
71
+            {
69 72
                 $modified = $this->modify($class, $proto);
70
-                if ($modified !== null) {
73
+                if ($modified !== null)
74
+                {
71 75
                     $targets[] = $modified;
72 76
                 }
73 77
                 continue;
74 78
             }
75 79
 
76
-            foreach ($proto as $target) {
77
-                if ($target instanceof \Throwable) {
80
+            foreach ($proto as $target)
81
+            {
82
+                if ($target instanceof \Throwable)
83
+                {
78 84
                     $targets[] = [
79 85
                         $class->getName(),
80 86
                         $target->getMessage(),
@@ -83,7 +89,8 @@  discard block
 block discarded – undo
83 89
                     continue 2;
84 90
                 }
85 91
 
86
-                if ($target === null) {
92
+                if ($target === null)
93
+                {
87 94
                     continue 2;
88 95
                 }
89 96
             }
@@ -91,14 +98,17 @@  discard block
 block discarded – undo
91 98
             $targets[] = [$class->getName(), $this->mergeNames($proto), $this->mergeTargets($proto)];
92 99
 
93 100
             $modified = $this->modify($class, $proto);
94
-            if ($modified !== null) {
101
+            if ($modified !== null)
102
+            {
95 103
                 $targets[] = $modified;
96 104
             }
97 105
         }
98 106
 
99
-        if (!empty($targets)) {
107
+        if (!empty($targets))
108
+        {
100 109
             $grid = $this->table(['Class:', 'Property:', 'Target:']);
101
-            foreach ($targets as $target) {
110
+            foreach ($targets as $target)
111
+            {
102 112
                 $grid->addRow($target);
103 113
             }
104 114
 
@@ -109,7 +119,8 @@  discard block
 block discarded – undo
109 119
     private function modify(\ReflectionClass $class, array $proto): ?array
110 120
     {
111 121
         $classDefinition = $this->extractor->extract($class->getFilename(), $proto);
112
-        try {
122
+        try
123
+        {
113 124
             $modified = $this->injector->injectDependencies(
114 125
                 file_get_contents($class->getFileName()),
115 126
                 $classDefinition,
@@ -120,7 +131,9 @@  discard block
 block discarded – undo
120 131
 
121 132
             file_put_contents($class->getFileName(), $modified);
122 133
             return null;
123
-        } catch (\Throwable $e) {
134
+        }
135
+        catch (\Throwable $e)
136
+        {
124 137
             return [$class->getName(), $e->getMessage(), "{$e->getFile()}:L{$e->getLine()}"];
125 138
         }
126 139
     }
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
     public function perform(): void
52 52
     {
53 53
         $prototyped = $this->locator->getTargetClasses();
54
-        if ($prototyped === []) {
54
+        if ($prototyped === []){
55 55
             $this->writeln('<comment>No prototyped classes found.</comment>');
56 56
 
57 57
             return;
@@ -59,18 +59,18 @@  discard block
 block discarded – undo
59 59
 
60 60
         $targets = [];
61 61
 
62
-        foreach ($prototyped as $class) {
62
+        foreach ($prototyped as $class){
63 63
             $proto = $this->getPrototypeProperties($class, $prototyped);
64
-            if (empty($proto)) {
64
+            if (empty($proto)){
65 65
                 $modified = $this->modify($class, $proto);
66
-                if ($modified !== null) {
66
+                if ($modified !== null){
67 67
                     $targets[] = $modified;
68 68
                 }
69 69
                 continue;
70 70
             }
71 71
 
72
-            foreach ($proto as $target) {
73
-                if ($target instanceof \Throwable) {
72
+            foreach ($proto as $target){
73
+                if ($target instanceof \Throwable){
74 74
                     $targets[] = [
75 75
                         $class->getName(),
76 76
                         $target->getMessage(),
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
                     continue 2;
80 80
                 }
81 81
 
82
-                if ($target === null) {
82
+                if ($target === null){
83 83
                     continue 2;
84 84
                 }
85 85
             }
@@ -87,14 +87,14 @@  discard block
 block discarded – undo
87 87
             $targets[] = [$class->getName(), $this->mergeNames($proto), $this->mergeTargets($proto)];
88 88
 
89 89
             $modified = $this->modify($class, $proto);
90
-            if ($modified !== null) {
90
+            if ($modified !== null){
91 91
                 $targets[] = $modified;
92 92
             }
93 93
         }
94 94
 
95
-        if (!empty($targets)) {
95
+        if (!empty($targets)){
96 96
             $grid = $this->table(['Class:', 'Property:', 'Target:']);
97
-            foreach ($targets as $target) {
97
+            foreach ($targets as $target){
98 98
                 $grid->addRow($target);
99 99
             }
100 100
 
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
     private function modify(\ReflectionClass $class, array $proto): ?array
106 106
     {
107 107
         $classDefinition = $this->extractor->extract($class->getFilename(), $proto);
108
-        try {
108
+        try{
109 109
             $modified = $this->injector->injectDependencies(
110 110
                 file_get_contents($class->getFileName()),
111 111
                 $classDefinition,
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 
117 117
             file_put_contents($class->getFileName(), $modified);
118 118
             return null;
119
-        } catch (\Throwable $e) {
119
+        }catch (\Throwable $e){
120 120
             return [$class->getName(), $e->getMessage(), "{$e->getFile()}:L{$e->getLine()}"];
121 121
         }
122 122
     }
Please login to merge, or discard this patch.
src/DataGrid/src/GridFactory.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
         ['view' => $view, 'source' => $source] = $this->applySorters($view, $source, $schema);
109 109
         ['view' => $view, 'source' => $source] = $this->applyPaginator($view, $source, $schema);
110 110
 
111
-        if (!is_iterable($source)) {
111
+        if (!is_iterable($source)){
112 112
             throw new GridViewException('GridView expects the source to be iterable after all.');
113 113
         }
114 114
 
@@ -126,11 +126,11 @@  discard block
 block discarded – undo
126 126
     protected function getFilters($source, GridSchema $schema): array
127 127
     {
128 128
         $filters = [];
129
-        foreach ($this->getOptionArray(static::KEY_FILTER) ?? [] as $name => $value) {
130
-            if ($schema->hasFilter($name)) {
129
+        foreach ($this->getOptionArray(static::KEY_FILTER) ?? [] as $name => $value){
130
+            if ($schema->hasFilter($name)){
131 131
                 $filter = $schema->getFilter($name)->withValue($value);
132 132
 
133
-                if ($filter !== null) {
133
+                if ($filter !== null){
134 134
                     $source = $this->compiler->compile($source, $filter);
135 135
                     $filters[$name] = $filter->getValue();
136 136
                 }
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 
143 143
     protected function applyCounter(GridInterface $view, $source, GridSchema $schema): array
144 144
     {
145
-        if (is_countable($source) && $this->getOption(static::KEY_FETCH_COUNT)) {
145
+        if (is_countable($source) && $this->getOption(static::KEY_FETCH_COUNT)){
146 146
             $view = $view->withOption(GridInterface::COUNT, ($this->count)($source));
147 147
         }
148 148
 
@@ -160,11 +160,11 @@  discard block
 block discarded – undo
160 160
     protected function getSorters($source, GridSchema $schema): array
161 161
     {
162 162
         $sorters = [];
163
-        foreach ($this->getOptionArray(static::KEY_SORT) ?? [] as $name => $value) {
164
-            if ($schema->hasSorter($name)) {
163
+        foreach ($this->getOptionArray(static::KEY_SORT) ?? [] as $name => $value){
164
+            if ($schema->hasSorter($name)){
165 165
                 $sorter = $schema->getSorter($name)->withDirection($value);
166 166
 
167
-                if ($sorter !== null) {
167
+                if ($sorter !== null){
168 168
                     $source = $this->compiler->compile($source, $sorter);
169 169
                     $sorters[$name] = $sorter->getValue();
170 170
                 }
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 
177 177
     protected function applyPaginator(GridInterface $view, $source, GridSchema $schema): array
178 178
     {
179
-        if ($schema->getPaginator() !== null) {
179
+        if ($schema->getPaginator() !== null){
180 180
             ['source' => $source, 'paginator' => $paginator] = $this->getPaginator($source, $schema);
181 181
             $view = $view->withOption(GridInterface::PAGINATOR, $paginator);
182 182
         }
@@ -187,12 +187,12 @@  discard block
 block discarded – undo
187 187
     protected function getPaginator($source, GridSchema $schema): array
188 188
     {
189 189
         $paginator = $schema->getPaginator();
190
-        if (!$paginator instanceof FilterInterface) {
190
+        if (!$paginator instanceof FilterInterface){
191 191
             throw new CompilerException('Paginator can not be null');
192 192
         }
193 193
 
194 194
         $withValue = $paginator->withValue($this->getOption(static::KEY_PAGINATE));
195
-        if ($withValue === null) {
195
+        if ($withValue === null){
196 196
             throw new CompilerException('Paginator can not be null');
197 197
         }
198 198
 
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
     protected function getOptionArray(string $option): array
212 212
     {
213 213
         $result = $this->getOption($option);
214
-        if (!is_array($result)) {
214
+        if (!is_array($result)){
215 215
             return [];
216 216
         }
217 217
 
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
      */
227 227
     protected function getOption(string $option)
228 228
     {
229
-        if ($this->input->hasValue($option)) {
229
+        if ($this->input->hasValue($option)){
230 230
             return $this->input->getValue($option);
231 231
         }
232 232
 
Please login to merge, or discard this patch.
Braces   +26 added lines, -13 removed lines patch added patch discarded remove patch
@@ -108,7 +108,8 @@  discard block
 block discarded – undo
108 108
         ['view' => $view, 'source' => $source] = $this->applySorters($view, $source, $schema);
109 109
         ['view' => $view, 'source' => $source] = $this->applyPaginator($view, $source, $schema);
110 110
 
111
-        if (!is_iterable($source)) {
111
+        if (!is_iterable($source))
112
+        {
112 113
             throw new GridViewException('GridView expects the source to be iterable after all.');
113 114
         }
114 115
 
@@ -126,11 +127,14 @@  discard block
 block discarded – undo
126 127
     protected function getFilters($source, GridSchema $schema): array
127 128
     {
128 129
         $filters = [];
129
-        foreach ($this->getOptionArray(static::KEY_FILTER) ?? [] as $name => $value) {
130
-            if ($schema->hasFilter($name)) {
130
+        foreach ($this->getOptionArray(static::KEY_FILTER) ?? [] as $name => $value)
131
+        {
132
+            if ($schema->hasFilter($name))
133
+            {
131 134
                 $filter = $schema->getFilter($name)->withValue($value);
132 135
 
133
-                if ($filter !== null) {
136
+                if ($filter !== null)
137
+                {
134 138
                     $source = $this->compiler->compile($source, $filter);
135 139
                     $filters[$name] = $filter->getValue();
136 140
                 }
@@ -142,7 +146,8 @@  discard block
 block discarded – undo
142 146
 
143 147
     protected function applyCounter(GridInterface $view, $source, GridSchema $schema): array
144 148
     {
145
-        if (is_countable($source) && $this->getOption(static::KEY_FETCH_COUNT)) {
149
+        if (is_countable($source) && $this->getOption(static::KEY_FETCH_COUNT))
150
+        {
146 151
             $view = $view->withOption(GridInterface::COUNT, ($this->count)($source));
147 152
         }
148 153
 
@@ -160,11 +165,14 @@  discard block
 block discarded – undo
160 165
     protected function getSorters($source, GridSchema $schema): array
161 166
     {
162 167
         $sorters = [];
163
-        foreach ($this->getOptionArray(static::KEY_SORT) ?? [] as $name => $value) {
164
-            if ($schema->hasSorter($name)) {
168
+        foreach ($this->getOptionArray(static::KEY_SORT) ?? [] as $name => $value)
169
+        {
170
+            if ($schema->hasSorter($name))
171
+            {
165 172
                 $sorter = $schema->getSorter($name)->withDirection($value);
166 173
 
167
-                if ($sorter !== null) {
174
+                if ($sorter !== null)
175
+                {
168 176
                     $source = $this->compiler->compile($source, $sorter);
169 177
                     $sorters[$name] = $sorter->getValue();
170 178
                 }
@@ -176,7 +184,8 @@  discard block
 block discarded – undo
176 184
 
177 185
     protected function applyPaginator(GridInterface $view, $source, GridSchema $schema): array
178 186
     {
179
-        if ($schema->getPaginator() !== null) {
187
+        if ($schema->getPaginator() !== null)
188
+        {
180 189
             ['source' => $source, 'paginator' => $paginator] = $this->getPaginator($source, $schema);
181 190
             $view = $view->withOption(GridInterface::PAGINATOR, $paginator);
182 191
         }
@@ -187,12 +196,14 @@  discard block
 block discarded – undo
187 196
     protected function getPaginator($source, GridSchema $schema): array
188 197
     {
189 198
         $paginator = $schema->getPaginator();
190
-        if (!$paginator instanceof FilterInterface) {
199
+        if (!$paginator instanceof FilterInterface)
200
+        {
191 201
             throw new CompilerException('Paginator can not be null');
192 202
         }
193 203
 
194 204
         $withValue = $paginator->withValue($this->getOption(static::KEY_PAGINATE));
195
-        if ($withValue === null) {
205
+        if ($withValue === null)
206
+        {
196 207
             throw new CompilerException('Paginator can not be null');
197 208
         }
198 209
 
@@ -211,7 +222,8 @@  discard block
 block discarded – undo
211 222
     protected function getOptionArray(string $option): array
212 223
     {
213 224
         $result = $this->getOption($option);
214
-        if (!is_array($result)) {
225
+        if (!is_array($result))
226
+        {
215 227
             return [];
216 228
         }
217 229
 
@@ -226,7 +238,8 @@  discard block
 block discarded – undo
226 238
      */
227 239
     protected function getOption(string $option)
228 240
     {
229
-        if ($this->input->hasValue($option)) {
241
+        if ($this->input->hasValue($option))
242
+        {
230 243
             return $this->input->getValue($option);
231 244
         }
232 245
 
Please login to merge, or discard this patch.
src/DataGrid/src/Specification/Value/DatetimeFormatValue.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -44,19 +44,19 @@
 block discarded – undo
44 44
      */
45 45
     public function convert($value)
46 46
     {
47
-        try {
47
+        try{
48 48
             $datetime = DateTimeImmutable::createFromFormat($this->readFrom, (string)$value);
49
-            if (!$datetime instanceof DateTimeImmutable) {
49
+            if (!$datetime instanceof DateTimeImmutable){
50 50
                 return null;
51 51
             }
52 52
 
53
-            if ($this->convertInto !== null) {
53
+            if ($this->convertInto !== null){
54 54
                 $formatted = $datetime->format($this->convertInto);
55 55
                 return is_string($formatted) ? $formatted : null;
56 56
             }
57 57
 
58 58
             return $datetime;
59
-        } catch (Throwable $e) {
59
+        }catch (Throwable $e){
60 60
             return null;
61 61
         }
62 62
     }
Please login to merge, or discard this patch.
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -44,19 +44,24 @@
 block discarded – undo
44 44
      */
45 45
     public function convert($value)
46 46
     {
47
-        try {
47
+        try
48
+        {
48 49
             $datetime = DateTimeImmutable::createFromFormat($this->readFrom, (string)$value);
49
-            if (!$datetime instanceof DateTimeImmutable) {
50
+            if (!$datetime instanceof DateTimeImmutable)
51
+            {
50 52
                 return null;
51 53
             }
52 54
 
53
-            if ($this->convertInto !== null) {
55
+            if ($this->convertInto !== null)
56
+            {
54 57
                 $formatted = $datetime->format($this->convertInto);
55 58
                 return is_string($formatted) ? $formatted : null;
56 59
             }
57 60
 
58 61
             return $datetime;
59
-        } catch (Throwable $e) {
62
+        }
63
+        catch (Throwable $e)
64
+        {
60 65
             return null;
61 66
         }
62 67
     }
Please login to merge, or discard this patch.
src/Validation/src/Checker/DatetimeChecker.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
      */
83 83
     public function format($value, string $format): bool
84 84
     {
85
-        if (!$this->isApplicableValue($value)) {
85
+        if (!$this->isApplicableValue($value)){
86 86
             return false;
87 87
         }
88 88
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
      */
111 111
     public function timezone($value): bool
112 112
     {
113
-        if (!is_scalar($value)) {
113
+        if (!is_scalar($value)){
114 114
             return false;
115 115
         }
116 116
 
@@ -150,9 +150,9 @@  discard block
 block discarded – undo
150 150
      */
151 151
     private function now(): ?\DateTimeInterface
152 152
     {
153
-        try {
153
+        try{
154 154
             return $this->date($this->now ?: 'now');
155
-        } catch (\Throwable $e) {
155
+        }catch (\Throwable $e){
156 156
             //here's the fail;
157 157
         }
158 158
 
@@ -165,25 +165,25 @@  discard block
 block discarded – undo
165 165
      */
166 166
     private function date($value): ?\DateTimeInterface
167 167
     {
168
-        if (is_callable($value)) {
168
+        if (is_callable($value)){
169 169
             $value = $value();
170 170
         }
171 171
 
172
-        if ($value instanceof \DateTimeInterface) {
172
+        if ($value instanceof \DateTimeInterface){
173 173
             return $value;
174 174
         }
175 175
 
176
-        if (!$this->isApplicableValue($value)) {
176
+        if (!$this->isApplicableValue($value)){
177 177
             return null;
178 178
         }
179 179
 
180
-        try {
181
-            if (!$value) {
180
+        try{
181
+            if (!$value){
182 182
                 $value = '0';
183 183
             }
184 184
 
185 185
             return new \DateTimeImmutable(is_numeric($value) ? sprintf('@%d', $value) : trim($value));
186
-        } catch (\Throwable $e) {
186
+        }catch (\Throwable $e){
187 187
             //here's the fail;
188 188
         }
189 189
 
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
     private function fromField(string $field): ?\DateTimeInterface
207 207
     {
208 208
         $before = $this->getValidator()->getValue($field);
209
-        if ($before !== null) {
209
+        if ($before !== null){
210 210
             return $this->date($before);
211 211
         }
212 212
 
Please login to merge, or discard this patch.
Braces   +24 added lines, -11 removed lines patch added patch discarded remove patch
@@ -82,7 +82,8 @@  discard block
 block discarded – undo
82 82
      */
83 83
     public function format($value, string $format): bool
84 84
     {
85
-        if (!$this->isApplicableValue($value)) {
85
+        if (!$this->isApplicableValue($value))
86
+        {
86 87
             return false;
87 88
         }
88 89
 
@@ -110,7 +111,8 @@  discard block
 block discarded – undo
110 111
      */
111 112
     public function timezone($value): bool
112 113
     {
113
-        if (!is_scalar($value)) {
114
+        if (!is_scalar($value))
115
+        {
114 116
             return false;
115 117
         }
116 118
 
@@ -150,9 +152,12 @@  discard block
 block discarded – undo
150 152
      */
151 153
     private function now(): ?\DateTimeInterface
152 154
     {
153
-        try {
155
+        try
156
+        {
154 157
             return $this->date($this->now ?: 'now');
155
-        } catch (\Throwable $e) {
158
+        }
159
+        catch (\Throwable $e)
160
+        {
156 161
             //here's the fail;
157 162
         }
158 163
 
@@ -165,25 +170,32 @@  discard block
 block discarded – undo
165 170
      */
166 171
     private function date($value): ?\DateTimeInterface
167 172
     {
168
-        if (is_callable($value)) {
173
+        if (is_callable($value))
174
+        {
169 175
             $value = $value();
170 176
         }
171 177
 
172
-        if ($value instanceof \DateTimeInterface) {
178
+        if ($value instanceof \DateTimeInterface)
179
+        {
173 180
             return $value;
174 181
         }
175 182
 
176
-        if (!$this->isApplicableValue($value)) {
183
+        if (!$this->isApplicableValue($value))
184
+        {
177 185
             return null;
178 186
         }
179 187
 
180
-        try {
181
-            if (!$value) {
188
+        try
189
+        {
190
+            if (!$value)
191
+            {
182 192
                 $value = '0';
183 193
             }
184 194
 
185 195
             return new \DateTimeImmutable(is_numeric($value) ? sprintf('@%d', $value) : trim($value));
186
-        } catch (\Throwable $e) {
196
+        }
197
+        catch (\Throwable $e)
198
+        {
187 199
             //here's the fail;
188 200
         }
189 201
 
@@ -206,7 +218,8 @@  discard block
 block discarded – undo
206 218
     private function fromField(string $field): ?\DateTimeInterface
207 219
     {
208 220
         $before = $this->getValidator()->getValue($field);
209
-        if ($before !== null) {
221
+        if ($before !== null)
222
+        {
210 223
             return $this->date($before);
211 224
         }
212 225
 
Please login to merge, or discard this patch.
src/Validation/tests/Checkers/DatetimeTest.php 2 patches
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
             [true, $callableNow, $now, true, true]
45 45
         ];
46 46
 
47
-        $callableFutureTime = static function () {
47
+        $callableFutureTime = static function (){
48 48
             return time() + 1000;
49 49
         };
50 50
         yield from [
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
             [false, $callableFutureTime, $now, true, true],
53 53
         ];
54 54
 
55
-        $callablePastTime = static function () {
55
+        $callablePastTime = static function (){
56 56
             return time() - 1000;
57 57
         };
58 58
         yield from [
@@ -231,24 +231,24 @@  discard block
 block discarded – undo
231 231
     public function validProvider(): array
232 232
     {
233 233
         return [
234
-            [true, time() - 1000,],
235
-            [true, time(),],
236
-            [true, date('u'),],
237
-            [true, time() + 1000,],
238
-            [true, '',],
239
-            [true, 'tomorrow +2hours',],
240
-            [true, 'yesterday -2hours',],
241
-            [true, 'now',],
242
-            [true, 'now + 1000 seconds',],
243
-            [true, 'now - 1000 seconds',],
244
-            [true, 0,],
245
-            [true, 1.1,],
246
-            [false, [],],
247
-            [false, false,],
248
-            [false, true,],
249
-            [false, null,],
250
-            [false, [],],
251
-            [false, new \stdClass(),],
234
+            [true, time() - 1000, ],
235
+            [true, time(), ],
236
+            [true, date('u'), ],
237
+            [true, time() + 1000, ],
238
+            [true, '', ],
239
+            [true, 'tomorrow +2hours', ],
240
+            [true, 'yesterday -2hours', ],
241
+            [true, 'now', ],
242
+            [true, 'now + 1000 seconds', ],
243
+            [true, 'now - 1000 seconds', ],
244
+            [true, 0, ],
245
+            [true, 1.1, ],
246
+            [false, [], ],
247
+            [false, false, ],
248
+            [false, true, ],
249
+            [false, null, ],
250
+            [false, [], ],
251
+            [false, new \stdClass(), ],
252 252
         ];
253 253
     }
254 254
 
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
     {
257 257
         $checker = new DatetimeChecker();
258 258
 
259
-        foreach (\DateTimeZone::listIdentifiers() as $identifier) {
259
+        foreach (\DateTimeZone::listIdentifiers() as $identifier){
260 260
             $this->assertTrue($checker->timezone($identifier));
261 261
             $this->assertFalse($checker->timezone(str_rot13($identifier)));
262 262
         }
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 
398 398
     private function now(): \Closure
399 399
     {
400
-        return static function () {
400
+        return static function (){
401 401
             return \time();
402 402
         };
403 403
     }
Please login to merge, or discard this patch.
Braces   +14 added lines, -7 removed lines patch added patch discarded remove patch
@@ -35,7 +35,8 @@  discard block
 block discarded – undo
35 35
     public function nowProvider(): iterable
36 36
     {
37 37
         $now = new \DateTime();
38
-        $callableNow = static function () use ($now) {
38
+        $callableNow = static function () use ($now)
39
+        {
39 40
             return $now;
40 41
         };
41 42
 
@@ -44,7 +45,8 @@  discard block
 block discarded – undo
44 45
             [true, $callableNow, $now, true, true]
45 46
         ];
46 47
 
47
-        $callableFutureTime = static function () {
48
+        $callableFutureTime = static function ()
49
+        {
48 50
             return time() + 1000;
49 51
         };
50 52
         yield from [
@@ -52,7 +54,8 @@  discard block
 block discarded – undo
52 54
             [false, $callableFutureTime, $now, true, true],
53 55
         ];
54 56
 
55
-        $callablePastTime = static function () {
57
+        $callablePastTime = static function ()
58
+        {
56 59
             return time() - 1000;
57 60
         };
58 61
         yield from [
@@ -256,7 +259,8 @@  discard block
 block discarded – undo
256 259
     {
257 260
         $checker = new DatetimeChecker();
258 261
 
259
-        foreach (\DateTimeZone::listIdentifiers() as $identifier) {
262
+        foreach (\DateTimeZone::listIdentifiers() as $identifier)
263
+        {
260 264
             $this->assertTrue($checker->timezone($identifier));
261 265
             $this->assertFalse($checker->timezone(str_rot13($identifier)));
262 266
         }
@@ -397,21 +401,24 @@  discard block
 block discarded – undo
397 401
 
398 402
     private function now(): \Closure
399 403
     {
400
-        return static function () {
404
+        return static function ()
405
+        {
401 406
             return \time();
402 407
         };
403 408
     }
404 409
 
405 410
     private function inFuture(int $seconds): \Closure
406 411
     {
407
-        return static function () use ($seconds) {
412
+        return static function () use ($seconds)
413
+        {
408 414
             return \time() + $seconds;
409 415
         };
410 416
     }
411 417
 
412 418
     private function inPast(int $seconds): \Closure
413 419
     {
414
-        return static function () use ($seconds) {
420
+        return static function () use ($seconds)
421
+        {
415 422
             return \time() - $seconds;
416 423
         };
417 424
     }
Please login to merge, or discard this patch.
src/Framework/Domain/PipelineInterceptor.php 2 patches
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -44,17 +44,17 @@  discard block
 block discarded – undo
44 44
     public function process(string $controller, string $action, array $parameters, CoreInterface $core)
45 45
     {
46 46
         $annotation = $this->readAnnotation($controller, $action);
47
-        if ($core instanceof InterceptorPipeline && $annotation->skipNext) {
47
+        if ($core instanceof InterceptorPipeline && $annotation->skipNext){
48 48
             $this->removeNextInterceptorsFromOriginalPipeline($core);
49 49
         }
50 50
 
51 51
         $pipeline = $this->getCachedPipeline($controller, $action, $annotation);
52
-        if (!empty($pipeline)) {
53
-            if ($core instanceof InterceptorPipeline) {
52
+        if (!empty($pipeline)){
53
+            if ($core instanceof InterceptorPipeline){
54 54
                 $this->injectInterceptorsIntoOriginalPipeline($core, $pipeline);
55
-            } else {
55
+            }else{
56 56
                 $core = new InterceptableCore($core);
57
-                foreach ($pipeline as $interceptor) {
57
+                foreach ($pipeline as $interceptor){
58 58
                     $core->addInterceptor($interceptor);
59 59
                 }
60 60
             }
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
      */
71 71
     private function readAnnotation(string $controller, string $action): Pipeline
72 72
     {
73
-        try {
73
+        try{
74 74
             $method = new \ReflectionMethod($controller, $action);
75
-        } catch (\ReflectionException $e) {
75
+        }catch (\ReflectionException $e){
76 76
             return new Pipeline();
77 77
         }
78 78
 
@@ -91,14 +91,14 @@  discard block
 block discarded – undo
91 91
 
92 92
         $oldInterceptors = $pipelineReflection->getValue($pipeline);
93 93
         $newInterceptors = [];
94
-        foreach ($oldInterceptors as $interceptor) {
94
+        foreach ($oldInterceptors as $interceptor){
95 95
             $newInterceptors[] = $interceptor;
96
-            if ($interceptor instanceof self) {
96
+            if ($interceptor instanceof self){
97 97
                 break;
98 98
             }
99 99
         }
100 100
 
101
-        if (count($newInterceptors) !== count($oldInterceptors)) {
101
+        if (count($newInterceptors) !== count($oldInterceptors)){
102 102
             $pipelineReflection->setValue($pipeline, $newInterceptors);
103 103
         }
104 104
         $pipelineReflection->setAccessible(false);
@@ -111,16 +111,16 @@  discard block
 block discarded – undo
111 111
 
112 112
         $oldInterceptors = $pipelineReflection->getValue($pipeline);
113 113
         $newInterceptors = [];
114
-        foreach ($oldInterceptors as $interceptor) {
114
+        foreach ($oldInterceptors as $interceptor){
115 115
             $newInterceptors[] = $interceptor;
116
-            if ($interceptor instanceof self) {
117
-                foreach ($interceptors as $newInterceptor) {
116
+            if ($interceptor instanceof self){
117
+                foreach ($interceptors as $newInterceptor){
118 118
                     $newInterceptors[] = $newInterceptor;
119 119
                 }
120 120
             }
121 121
         }
122 122
 
123
-        if (count($newInterceptors) !== count($oldInterceptors)) {
123
+        if (count($newInterceptors) !== count($oldInterceptors)){
124 124
             $pipelineReflection->setValue($pipeline, $newInterceptors);
125 125
         }
126 126
         $pipelineReflection->setAccessible(false);
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
     private function getCachedPipeline(string $controller, string $action, Pipeline $annotation): array
136 136
     {
137 137
         $key = "{$controller}:{$action}";
138
-        if (!array_key_exists($key, $this->cache)) {
138
+        if (!array_key_exists($key, $this->cache)){
139 139
             $this->cache[$key] = $this->extractAnnotationPipeline($annotation);
140 140
         }
141 141
 
@@ -149,10 +149,10 @@  discard block
 block discarded – undo
149 149
     private function extractAnnotationPipeline(Pipeline $annotation): array
150 150
     {
151 151
         $interceptors = [];
152
-        foreach ($annotation->pipeline as $interceptor) {
153
-            try {
152
+        foreach ($annotation->pipeline as $interceptor){
153
+            try{
154 154
                 $interceptors[] = $this->container->get($interceptor);
155
-            } catch (\Throwable $e) {
155
+            }catch (\Throwable $e){
156 156
             }
157 157
         }
158 158
 
Please login to merge, or discard this patch.
Braces   +39 added lines, -18 removed lines patch added patch discarded remove patch
@@ -44,17 +44,23 @@  discard block
 block discarded – undo
44 44
     public function process(string $controller, string $action, array $parameters, CoreInterface $core)
45 45
     {
46 46
         $annotation = $this->readAnnotation($controller, $action);
47
-        if ($core instanceof InterceptorPipeline && $annotation->skipNext) {
47
+        if ($core instanceof InterceptorPipeline && $annotation->skipNext)
48
+        {
48 49
             $this->removeNextInterceptorsFromOriginalPipeline($core);
49 50
         }
50 51
 
51 52
         $pipeline = $this->getCachedPipeline($controller, $action, $annotation);
52
-        if (!empty($pipeline)) {
53
-            if ($core instanceof InterceptorPipeline) {
53
+        if (!empty($pipeline))
54
+        {
55
+            if ($core instanceof InterceptorPipeline)
56
+            {
54 57
                 $this->injectInterceptorsIntoOriginalPipeline($core, $pipeline);
55
-            } else {
58
+            }
59
+            else
60
+            {
56 61
                 $core = new InterceptableCore($core);
57
-                foreach ($pipeline as $interceptor) {
62
+                foreach ($pipeline as $interceptor)
63
+                {
58 64
                     $core->addInterceptor($interceptor);
59 65
                 }
60 66
             }
@@ -70,9 +76,12 @@  discard block
 block discarded – undo
70 76
      */
71 77
     private function readAnnotation(string $controller, string $action): Pipeline
72 78
     {
73
-        try {
79
+        try
80
+        {
74 81
             $method = new \ReflectionMethod($controller, $action);
75
-        } catch (\ReflectionException $e) {
82
+        }
83
+        catch (\ReflectionException $e)
84
+        {
76 85
             return new Pipeline();
77 86
         }
78 87
 
@@ -91,14 +100,17 @@  discard block
 block discarded – undo
91 100
 
92 101
         $oldInterceptors = $pipelineReflection->getValue($pipeline);
93 102
         $newInterceptors = [];
94
-        foreach ($oldInterceptors as $interceptor) {
103
+        foreach ($oldInterceptors as $interceptor)
104
+        {
95 105
             $newInterceptors[] = $interceptor;
96
-            if ($interceptor instanceof self) {
106
+            if ($interceptor instanceof self)
107
+            {
97 108
                 break;
98 109
             }
99 110
         }
100 111
 
101
-        if (count($newInterceptors) !== count($oldInterceptors)) {
112
+        if (count($newInterceptors) !== count($oldInterceptors))
113
+        {
102 114
             $pipelineReflection->setValue($pipeline, $newInterceptors);
103 115
         }
104 116
         $pipelineReflection->setAccessible(false);
@@ -111,16 +123,20 @@  discard block
 block discarded – undo
111 123
 
112 124
         $oldInterceptors = $pipelineReflection->getValue($pipeline);
113 125
         $newInterceptors = [];
114
-        foreach ($oldInterceptors as $interceptor) {
126
+        foreach ($oldInterceptors as $interceptor)
127
+        {
115 128
             $newInterceptors[] = $interceptor;
116
-            if ($interceptor instanceof self) {
117
-                foreach ($interceptors as $newInterceptor) {
129
+            if ($interceptor instanceof self)
130
+            {
131
+                foreach ($interceptors as $newInterceptor)
132
+                {
118 133
                     $newInterceptors[] = $newInterceptor;
119 134
                 }
120 135
             }
121 136
         }
122 137
 
123
-        if (count($newInterceptors) !== count($oldInterceptors)) {
138
+        if (count($newInterceptors) !== count($oldInterceptors))
139
+        {
124 140
             $pipelineReflection->setValue($pipeline, $newInterceptors);
125 141
         }
126 142
         $pipelineReflection->setAccessible(false);
@@ -135,7 +151,8 @@  discard block
 block discarded – undo
135 151
     private function getCachedPipeline(string $controller, string $action, Pipeline $annotation): array
136 152
     {
137 153
         $key = "{$controller}:{$action}";
138
-        if (!array_key_exists($key, $this->cache)) {
154
+        if (!array_key_exists($key, $this->cache))
155
+        {
139 156
             $this->cache[$key] = $this->extractAnnotationPipeline($annotation);
140 157
         }
141 158
 
@@ -149,10 +166,14 @@  discard block
 block discarded – undo
149 166
     private function extractAnnotationPipeline(Pipeline $annotation): array
150 167
     {
151 168
         $interceptors = [];
152
-        foreach ($annotation->pipeline as $interceptor) {
153
-            try {
169
+        foreach ($annotation->pipeline as $interceptor)
170
+        {
171
+            try
172
+            {
154 173
                 $interceptors[] = $this->container->get($interceptor);
155
-            } catch (\Throwable $e) {
174
+            }
175
+            catch (\Throwable $e)
176
+            {
156 177
             }
157 178
         }
158 179
 
Please login to merge, or discard this patch.
tests/app/src/Interceptor/Append.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
     public function process(string $controller, string $action, array $parameters, CoreInterface $core): array
20 20
     {
21 21
         $result = $core->callAction($controller, $action, $parameters);
22
-        if (!is_array($result)) {
22
+        if (!is_array($result)){
23 23
             $result = [];
24 24
         }
25 25
         $result[] = $this->string;
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,8 @@
 block discarded – undo
19 19
     public function process(string $controller, string $action, array $parameters, CoreInterface $core): array
20 20
     {
21 21
         $result = $core->callAction($controller, $action, $parameters);
22
-        if (!is_array($result)) {
22
+        if (!is_array($result))
23
+        {
23 24
             $result = [];
24 25
         }
25 26
         $result[] = $this->string;
Please login to merge, or discard this patch.
tests/app/src/Bootloader/AppBootloader.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -173,7 +173,8 @@
 block discarded – undo
173 173
     {
174 174
         $core = new InterceptableCore($this->core);
175 175
 
176
-        foreach ($interceptors as $interceptor) {
176
+        foreach ($interceptors as $interceptor)
177
+        {
177 178
             $core->addInterceptor(is_object($interceptor) ? $interceptor : $this->container->get($interceptor));
178 179
         }
179 180
 
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -89,8 +89,8 @@  discard block
 block discarded – undo
89 89
             new Route('/auth/<action>', new Controller(AuthController::class))
90 90
         );
91 91
 
92
-        $views->addDirectory('custom', __DIR__ . '/../../views/custom/');
93
-        $views->addDirectory('stempler', __DIR__ . '/../../views/stempler/');
92
+        $views->addDirectory('custom', __DIR__.'/../../views/custom/');
93
+        $views->addDirectory('stempler', __DIR__.'/../../views/stempler/');
94 94
         $views->addEngine(TestEngine::class);
95 95
 
96 96
         $validation->addAlias('aliased', 'notEmpty');
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
     {
233 233
         $core = new InterceptableCore($this->core);
234 234
 
235
-        foreach ($interceptors as $interceptor) {
235
+        foreach ($interceptors as $interceptor){
236 236
             $core->addInterceptor(is_object($interceptor) ? $interceptor : $this->container->get($interceptor));
237 237
         }
238 238
 
Please login to merge, or discard this patch.