Test Failed
Pull Request — master (#787)
by Aleksei
14:14 queued 08:27
created
src/Bridge/Stempler/src/Config/StemplerConfig.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -24,8 +24,8 @@  discard block
 block discarded – undo
24 24
     public function getDirectives(): array
25 25
     {
26 26
         $directives = [];
27
-        foreach ($this->config['directives'] as $directive) {
28
-            if (\is_object($directive) && !$directive instanceof Autowire) {
27
+        foreach ($this->config['directives'] as $directive){
28
+            if (\is_object($directive) && !$directive instanceof Autowire){
29 29
                 $directives[] = $directive;
30 30
                 continue;
31 31
             }
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
     public function getProcessors(): array
43 43
     {
44 44
         $processors = [];
45
-        foreach ($this->config['processors'] as $processor) {
46
-            if (is_object($processor) && !$processor instanceof Autowire) {
45
+        foreach ($this->config['processors'] as $processor){
46
+            if (is_object($processor) && !$processor instanceof Autowire){
47 47
                 $processors[] = $processor;
48 48
                 continue;
49 49
             }
@@ -57,8 +57,8 @@  discard block
 block discarded – undo
57 57
     public function getVisitors(int $stage): array
58 58
     {
59 59
         $visitors = [];
60
-        foreach ($this->config['visitors'][$stage] ?? [] as $visitor) {
61
-            if (\is_object($visitor) && !$visitor instanceof Autowire) {
60
+        foreach ($this->config['visitors'][$stage] ?? [] as $visitor){
61
+            if (\is_object($visitor) && !$visitor instanceof Autowire){
62 62
                 $visitors[] = $visitor;
63 63
                 continue;
64 64
             }
@@ -74,11 +74,11 @@  discard block
 block discarded – undo
74 74
      */
75 75
     private function wire(mixed $item): Autowire
76 76
     {
77
-        if ($item instanceof Autowire) {
77
+        if ($item instanceof Autowire){
78 78
             return $item;
79 79
         }
80 80
 
81
-        if (\is_string($item)) {
81
+        if (\is_string($item)){
82 82
             return new Autowire($item);
83 83
         }
84 84
 
Please login to merge, or discard this patch.
Braces   +16 added lines, -8 removed lines patch added patch discarded remove patch
@@ -24,8 +24,10 @@  discard block
 block discarded – undo
24 24
     public function getDirectives(): array
25 25
     {
26 26
         $directives = [];
27
-        foreach ($this->config['directives'] as $directive) {
28
-            if (\is_object($directive) && !$directive instanceof Autowire) {
27
+        foreach ($this->config['directives'] as $directive)
28
+        {
29
+            if (\is_object($directive) && !$directive instanceof Autowire)
30
+            {
29 31
                 $directives[] = $directive;
30 32
                 continue;
31 33
             }
@@ -42,8 +44,10 @@  discard block
 block discarded – undo
42 44
     public function getProcessors(): array
43 45
     {
44 46
         $processors = [];
45
-        foreach ($this->config['processors'] as $processor) {
46
-            if (is_object($processor) && !$processor instanceof Autowire) {
47
+        foreach ($this->config['processors'] as $processor)
48
+        {
49
+            if (is_object($processor) && !$processor instanceof Autowire)
50
+            {
47 51
                 $processors[] = $processor;
48 52
                 continue;
49 53
             }
@@ -57,8 +61,10 @@  discard block
 block discarded – undo
57 61
     public function getVisitors(int $stage): array
58 62
     {
59 63
         $visitors = [];
60
-        foreach ($this->config['visitors'][$stage] ?? [] as $visitor) {
61
-            if (\is_object($visitor) && !$visitor instanceof Autowire) {
64
+        foreach ($this->config['visitors'][$stage] ?? [] as $visitor)
65
+        {
66
+            if (\is_object($visitor) && !$visitor instanceof Autowire)
67
+            {
62 68
                 $visitors[] = $visitor;
63 69
                 continue;
64 70
             }
@@ -74,11 +80,13 @@  discard block
 block discarded – undo
74 80
      */
75 81
     private function wire(mixed $item): Autowire
76 82
     {
77
-        if ($item instanceof Autowire) {
83
+        if ($item instanceof Autowire)
84
+        {
78 85
             return $item;
79 86
         }
80 87
 
81
-        if (\is_string($item)) {
88
+        if (\is_string($item))
89
+        {
82 90
             return new Autowire($item);
83 91
         }
84 92
 
Please login to merge, or discard this patch.
src/Bridge/Stempler/src/Directive/RouteDirective.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 {
17 17
     public function __construct(
18 18
         private readonly ContainerInterface $container
19
-    ) {
19
+    ){
20 20
         parent::__construct();
21 21
     }
22 22
 
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
      */
26 26
     public function renderRoute(Directive $directive): string
27 27
     {
28
-        if (\count($directive->values) < 1) {
28
+        if (\count($directive->values) < 1){
29 29
             throw new DirectiveException(
30 30
                 'Unable to call @route directive, at least 1 value is required',
31 31
                 $directive->getContext()
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
     {
46 46
         $vars = [];
47 47
         $restore = [];
48
-        foreach ($params as $key => $value) {
49
-            if (\is_string($value) && \preg_match('#\{.*\}#', $value)) {
48
+        foreach ($params as $key => $value){
49
+            if (\is_string($value) && \preg_match('#\{.*\}#', $value)){
50 50
                 $restore[\sprintf('__%s__', $key)] = $value;
51 51
                 $value = \sprintf('__%s__', $key);
52 52
             }
@@ -54,12 +54,12 @@  discard block
 block discarded – undo
54 54
             $vars[$key] = $value;
55 55
         }
56 56
 
57
-        try {
57
+        try{
58 58
             return \strtr(
59 59
                 $this->container->get(RouterInterface::class)->uri($route, $vars)->__toString(),
60 60
                 $restore
61 61
             );
62
-        } catch (UndefinedRouteException $e) {
62
+        }catch (UndefinedRouteException $e){
63 63
             throw new RouterException("No such route {$route}", $e->getCode(), $e);
64 64
         }
65 65
     }
Please login to merge, or discard this patch.
Braces   +11 added lines, -5 removed lines patch added patch discarded remove patch
@@ -25,7 +25,8 @@  discard block
 block discarded – undo
25 25
      */
26 26
     public function renderRoute(Directive $directive): string
27 27
     {
28
-        if (\count($directive->values) < 1) {
28
+        if (\count($directive->values) < 1)
29
+        {
29 30
             throw new DirectiveException(
30 31
                 'Unable to call @route directive, at least 1 value is required',
31 32
                 $directive->getContext()
@@ -45,8 +46,10 @@  discard block
 block discarded – undo
45 46
     {
46 47
         $vars = [];
47 48
         $restore = [];
48
-        foreach ($params as $key => $value) {
49
-            if (\is_string($value) && \preg_match('#\{.*\}#', $value)) {
49
+        foreach ($params as $key => $value)
50
+        {
51
+            if (\is_string($value) && \preg_match('#\{.*\}#', $value))
52
+            {
50 53
                 $restore[\sprintf('__%s__', $key)] = $value;
51 54
                 $value = \sprintf('__%s__', $key);
52 55
             }
@@ -54,12 +57,15 @@  discard block
 block discarded – undo
54 57
             $vars[$key] = $value;
55 58
         }
56 59
 
57
-        try {
60
+        try
61
+        {
58 62
             return \strtr(
59 63
                 $this->container->get(RouterInterface::class)->uri($route, $vars)->__toString(),
60 64
                 $restore
61 65
             );
62
-        } catch (UndefinedRouteException $e) {
66
+        }
67
+        catch (UndefinedRouteException $e)
68
+        {
63 69
             throw new RouterException("No such route {$route}", $e->getCode(), $e);
64 70
         }
65 71
     }
Please login to merge, or discard this patch.
src/Bridge/Stempler/src/Directive/ContainerDirective.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,14 +17,14 @@
 block discarded – undo
17 17
      */
18 18
     public function renderInject(Directive $directive): string
19 19
     {
20
-        if (\count($directive->values) < 2 || (string) $directive->values[0] === '') {
20
+        if (\count($directive->values) < 2 || (string)$directive->values[0] === ''){
21 21
             throw new DirectiveException(
22 22
                 'Unable to call @inject directive, 2 values required',
23 23
                 $directive->getContext()
24 24
             );
25 25
         }
26 26
 
27
-        if ($directive->values[0][0] === '$') {
27
+        if ($directive->values[0][0] === '$'){
28 28
             return \sprintf(
29 29
                 '<?php %s = $this->container->get(%s); ?>',
30 30
                 $directive->values[0],
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,14 +17,16 @@
 block discarded – undo
17 17
      */
18 18
     public function renderInject(Directive $directive): string
19 19
     {
20
-        if (\count($directive->values) < 2 || (string) $directive->values[0] === '') {
20
+        if (\count($directive->values) < 2 || (string) $directive->values[0] === '')
21
+        {
21 22
             throw new DirectiveException(
22 23
                 'Unable to call @inject directive, 2 values required',
23 24
                 $directive->getContext()
24 25
             );
25 26
         }
26 27
 
27
-        if ($directive->values[0][0] === '$') {
28
+        if ($directive->values[0][0] === '$')
29
+        {
28 30
             return \sprintf(
29 31
                 '<?php %s = $this->container->get(%s); ?>',
30 32
                 $directive->values[0],
Please login to merge, or discard this patch.
src/Bridge/Stempler/src/StemplerEngine.php 2 patches
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
         private readonly ContainerInterface $container,
46 46
         private readonly StemplerConfig $config,
47 47
         private readonly ?StemplerCache $cache = null
48
-    ) {
48
+    ){
49 49
     }
50 50
 
51 51
     public function getContainer(): ContainerInterface
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 
65 65
     public function getLoader(): LoaderInterface
66 66
     {
67
-        if ($this->loader === null) {
67
+        if ($this->loader === null){
68 68
             throw new EngineException('No associated loader found');
69 69
         }
70 70
 
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
      */
77 77
     public function getBuilder(ContextInterface $context): Builder
78 78
     {
79
-        if ($this->builder === null) {
79
+        if ($this->builder === null){
80 80
             throw new EngineException('No associated builder found');
81 81
         }
82 82
 
@@ -97,20 +97,20 @@  discard block
 block discarded – undo
97 97
         // cache key
98 98
         $key = $this->cacheKey($view, $context);
99 99
 
100
-        if ($this->cache !== null && $this->cache->isFresh($key)) {
100
+        if ($this->cache !== null && $this->cache->isFresh($key)){
101 101
             $this->cache->load($key);
102
-        } elseif (!\class_exists($class)) {
103
-            try {
102
+        } elseif (!\class_exists($class)){
103
+            try{
104 104
                 $builder = $this->getBuilder($context);
105 105
 
106 106
                 $result = $builder->compile($path);
107
-            } catch (Throwable $e) {
107
+            }catch (Throwable $e){
108 108
                 throw new CompileException($e);
109 109
             }
110 110
 
111 111
             $compiled = $this->compileClass($class, $result);
112 112
 
113
-            if ($this->cache !== null) {
113
+            if ($this->cache !== null){
114 114
                 $this->cache->write(
115 115
                     $key,
116 116
                     $compiled,
@@ -123,13 +123,13 @@  discard block
 block discarded – undo
123 123
                 $this->cache->load($key);
124 124
             }
125 125
 
126
-            if (!\class_exists($class)) {
126
+            if (!\class_exists($class)){
127 127
                 // runtime initialization
128
-                eval('?>' . $compiled);
128
+                eval('?>'.$compiled);
129 129
             }
130 130
         }
131 131
 
132
-        if (!\class_exists($class)) {
132
+        if (!\class_exists($class)){
133 133
             throw new EngineException(\sprintf('Unable to load `%s`, cache might be corrupted', $path));
134 134
         }
135 135
 
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 
139 139
     public function reset(string $path, ContextInterface $context): void
140 140
     {
141
-        if ($this->cache === null) {
141
+        if ($this->cache === null){
142 142
             return;
143 143
         }
144 144
 
@@ -157,12 +157,12 @@  discard block
 block discarded – undo
157 157
      */
158 158
     public function makeSourceMap(string $path, ContextInterface $context): ?SourceMap
159 159
     {
160
-        try {
160
+        try{
161 161
             $builder = $this->getBuilder($context);
162 162
 
163 163
             // there is no need to cache sourcemaps since they are used during the exception only
164 164
             return $builder->compile($path)->getSourceMap($builder->getLoader());
165
-        } catch (Throwable) {
165
+        }catch (Throwable){
166 166
             return null;
167 167
         }
168 168
     }
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 
196 196
     private function className(ViewSource $source, ContextInterface $context): string
197 197
     {
198
-        return $this->classPrefix . $this->cacheKey($source, $context);
198
+        return $this->classPrefix.$this->cacheKey($source, $context);
199 199
     }
200 200
 
201 201
     private function cacheKey(ViewSource $source, ContextInterface $context): string
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
         $builder = new Builder($loader);
216 216
 
217 217
         $directivesGroup = new DirectiveGroup();
218
-        foreach ($this->getDirectives() as $directive) {
218
+        foreach ($this->getDirectives() as $directive){
219 219
             $directivesGroup->addDirective($directive);
220 220
         }
221 221
 
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
         $builder->getCompiler()->addRenderer(new DynamicRenderer(new DirectiveGroup($this->getDirectives())));
247 247
 
248 248
         // ATS modifications
249
-        foreach ($this->getVisitors(Builder::STAGE_PREPARE) as $visitor) {
249
+        foreach ($this->getVisitors(Builder::STAGE_PREPARE) as $visitor){
250 250
             $builder->addVisitor($visitor, Builder::STAGE_PREPARE);
251 251
         }
252 252
 
@@ -259,15 +259,15 @@  discard block
 block discarded – undo
259 259
         $builder->addVisitor(new ResolveImports($builder), Builder::STAGE_TRANSFORM);
260 260
         $builder->addVisitor(new ExtendsParent($builder), Builder::STAGE_TRANSFORM);
261 261
 
262
-        foreach ($this->getVisitors(Builder::STAGE_TRANSFORM) as $visitor) {
262
+        foreach ($this->getVisitors(Builder::STAGE_TRANSFORM) as $visitor){
263 263
             $builder->addVisitor($visitor, Builder::STAGE_TRANSFORM);
264 264
         }
265 265
 
266
-        foreach ($this->getVisitors(Builder::STAGE_FINALIZE) as $visitor) {
266
+        foreach ($this->getVisitors(Builder::STAGE_FINALIZE) as $visitor){
267 267
             $builder->addVisitor($visitor, Builder::STAGE_FINALIZE);
268 268
         }
269 269
 
270
-        foreach ($this->getVisitors(Builder::STAGE_COMPILE) as $visitor) {
270
+        foreach ($this->getVisitors(Builder::STAGE_COMPILE) as $visitor){
271 271
             $builder->addVisitor($visitor, Builder::STAGE_COMPILE);
272 272
         }
273 273
 
@@ -280,8 +280,8 @@  discard block
 block discarded – undo
280 280
     private function getVisitors(int $stage): iterable
281 281
     {
282 282
         $result = [];
283
-        foreach ($this->config->getVisitors($stage) as $visitor) {
284
-            if ($visitor instanceof Autowire) {
283
+        foreach ($this->config->getVisitors($stage) as $visitor){
284
+            if ($visitor instanceof Autowire){
285 285
                 $result[] = $visitor->resolve($this->container->get(FactoryInterface::class));
286 286
                 continue;
287 287
             }
@@ -298,8 +298,8 @@  discard block
 block discarded – undo
298 298
     private function getProcessors(): iterable
299 299
     {
300 300
         $result = [];
301
-        foreach ($this->config->getProcessors() as $processor) {
302
-            if ($processor instanceof Autowire) {
301
+        foreach ($this->config->getProcessors() as $processor){
302
+            if ($processor instanceof Autowire){
303 303
                 $result[] = $processor->resolve($this->container->get(FactoryInterface::class));
304 304
                 continue;
305 305
             }
@@ -316,8 +316,8 @@  discard block
 block discarded – undo
316 316
     private function getDirectives(): iterable
317 317
     {
318 318
         $result = [];
319
-        foreach ($this->config->getDirectives() as $directive) {
320
-            if ($directive instanceof Autowire) {
319
+        foreach ($this->config->getDirectives() as $directive){
320
+            if ($directive instanceof Autowire){
321 321
                 $result[] = $directive->resolve($this->container->get(FactoryInterface::class));
322 322
                 continue;
323 323
             }
Please login to merge, or discard this patch.
Braces   +49 added lines, -23 removed lines patch added patch discarded remove patch
@@ -64,7 +64,8 @@  discard block
 block discarded – undo
64 64
 
65 65
     public function getLoader(): LoaderInterface
66 66
     {
67
-        if ($this->loader === null) {
67
+        if ($this->loader === null)
68
+        {
68 69
             throw new EngineException('No associated loader found');
69 70
         }
70 71
 
@@ -76,7 +77,8 @@  discard block
 block discarded – undo
76 77
      */
77 78
     public function getBuilder(ContextInterface $context): Builder
78 79
     {
79
-        if ($this->builder === null) {
80
+        if ($this->builder === null)
81
+        {
80 82
             throw new EngineException('No associated builder found');
81 83
         }
82 84
 
@@ -97,20 +99,27 @@  discard block
 block discarded – undo
97 99
         // cache key
98 100
         $key = $this->cacheKey($view, $context);
99 101
 
100
-        if ($this->cache !== null && $this->cache->isFresh($key)) {
102
+        if ($this->cache !== null && $this->cache->isFresh($key))
103
+        {
101 104
             $this->cache->load($key);
102
-        } elseif (!\class_exists($class)) {
103
-            try {
105
+        }
106
+        elseif (!\class_exists($class))
107
+        {
108
+            try
109
+            {
104 110
                 $builder = $this->getBuilder($context);
105 111
 
106 112
                 $result = $builder->compile($path);
107
-            } catch (Throwable $e) {
113
+            }
114
+            catch (Throwable $e)
115
+            {
108 116
                 throw new CompileException($e);
109 117
             }
110 118
 
111 119
             $compiled = $this->compileClass($class, $result);
112 120
 
113
-            if ($this->cache !== null) {
121
+            if ($this->cache !== null)
122
+            {
114 123
                 $this->cache->write(
115 124
                     $key,
116 125
                     $compiled,
@@ -123,13 +132,15 @@  discard block
 block discarded – undo
123 132
                 $this->cache->load($key);
124 133
             }
125 134
 
126
-            if (!\class_exists($class)) {
135
+            if (!\class_exists($class))
136
+            {
127 137
                 // runtime initialization
128 138
                 eval('?>' . $compiled);
129 139
             }
130 140
         }
131 141
 
132
-        if (!\class_exists($class)) {
142
+        if (!\class_exists($class))
143
+        {
133 144
             throw new EngineException(\sprintf('Unable to load `%s`, cache might be corrupted', $path));
134 145
         }
135 146
 
@@ -138,7 +149,8 @@  discard block
 block discarded – undo
138 149
 
139 150
     public function reset(string $path, ContextInterface $context): void
140 151
     {
141
-        if ($this->cache === null) {
152
+        if ($this->cache === null)
153
+        {
142 154
             return;
143 155
         }
144 156
 
@@ -157,12 +169,15 @@  discard block
 block discarded – undo
157 169
      */
158 170
     public function makeSourceMap(string $path, ContextInterface $context): ?SourceMap
159 171
     {
160
-        try {
172
+        try
173
+        {
161 174
             $builder = $this->getBuilder($context);
162 175
 
163 176
             // there is no need to cache sourcemaps since they are used during the exception only
164 177
             return $builder->compile($path)->getSourceMap($builder->getLoader());
165
-        } catch (Throwable) {
178
+        }
179
+        catch (Throwable)
180
+        {
166 181
             return null;
167 182
         }
168 183
     }
@@ -215,7 +230,8 @@  discard block
 block discarded – undo
215 230
         $builder = new Builder($loader);
216 231
 
217 232
         $directivesGroup = new DirectiveGroup();
218
-        foreach ($this->getDirectives() as $directive) {
233
+        foreach ($this->getDirectives() as $directive)
234
+        {
219 235
             $directivesGroup->addDirective($directive);
220 236
         }
221 237
 
@@ -246,7 +262,8 @@  discard block
 block discarded – undo
246 262
         $builder->getCompiler()->addRenderer(new DynamicRenderer(new DirectiveGroup($this->getDirectives())));
247 263
 
248 264
         // ATS modifications
249
-        foreach ($this->getVisitors(Builder::STAGE_PREPARE) as $visitor) {
265
+        foreach ($this->getVisitors(Builder::STAGE_PREPARE) as $visitor)
266
+        {
250 267
             $builder->addVisitor($visitor, Builder::STAGE_PREPARE);
251 268
         }
252 269
 
@@ -259,15 +276,18 @@  discard block
 block discarded – undo
259 276
         $builder->addVisitor(new ResolveImports($builder), Builder::STAGE_TRANSFORM);
260 277
         $builder->addVisitor(new ExtendsParent($builder), Builder::STAGE_TRANSFORM);
261 278
 
262
-        foreach ($this->getVisitors(Builder::STAGE_TRANSFORM) as $visitor) {
279
+        foreach ($this->getVisitors(Builder::STAGE_TRANSFORM) as $visitor)
280
+        {
263 281
             $builder->addVisitor($visitor, Builder::STAGE_TRANSFORM);
264 282
         }
265 283
 
266
-        foreach ($this->getVisitors(Builder::STAGE_FINALIZE) as $visitor) {
284
+        foreach ($this->getVisitors(Builder::STAGE_FINALIZE) as $visitor)
285
+        {
267 286
             $builder->addVisitor($visitor, Builder::STAGE_FINALIZE);
268 287
         }
269 288
 
270
-        foreach ($this->getVisitors(Builder::STAGE_COMPILE) as $visitor) {
289
+        foreach ($this->getVisitors(Builder::STAGE_COMPILE) as $visitor)
290
+        {
271 291
             $builder->addVisitor($visitor, Builder::STAGE_COMPILE);
272 292
         }
273 293
 
@@ -280,8 +300,10 @@  discard block
 block discarded – undo
280 300
     private function getVisitors(int $stage): iterable
281 301
     {
282 302
         $result = [];
283
-        foreach ($this->config->getVisitors($stage) as $visitor) {
284
-            if ($visitor instanceof Autowire) {
303
+        foreach ($this->config->getVisitors($stage) as $visitor)
304
+        {
305
+            if ($visitor instanceof Autowire)
306
+            {
285 307
                 $result[] = $visitor->resolve($this->container->get(FactoryInterface::class));
286 308
                 continue;
287 309
             }
@@ -298,8 +320,10 @@  discard block
 block discarded – undo
298 320
     private function getProcessors(): iterable
299 321
     {
300 322
         $result = [];
301
-        foreach ($this->config->getProcessors() as $processor) {
302
-            if ($processor instanceof Autowire) {
323
+        foreach ($this->config->getProcessors() as $processor)
324
+        {
325
+            if ($processor instanceof Autowire)
326
+            {
303 327
                 $result[] = $processor->resolve($this->container->get(FactoryInterface::class));
304 328
                 continue;
305 329
             }
@@ -316,8 +340,10 @@  discard block
 block discarded – undo
316 340
     private function getDirectives(): iterable
317 341
     {
318 342
         $result = [];
319
-        foreach ($this->config->getDirectives() as $directive) {
320
-            if ($directive instanceof Autowire) {
343
+        foreach ($this->config->getDirectives() as $directive)
344
+        {
345
+            if ($directive instanceof Autowire)
346
+            {
321 347
                 $result[] = $directive->resolve($this->container->get(FactoryInterface::class));
322 348
                 continue;
323 349
             }
Please login to merge, or discard this patch.
src/Bridge/Stempler/src/Visitor/FormatHTML.php 2 patches
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -30,30 +30,30 @@  discard block
 block discarded – undo
30 30
 
31 31
     public function enterNode(mixed $node, VisitorContext $ctx): mixed
32 32
     {
33
-        if (!$node instanceof Template && !$node instanceof Block && !$node instanceof Tag) {
33
+        if (!$node instanceof Template && !$node instanceof Block && !$node instanceof Tag){
34 34
             return null;
35 35
         }
36 36
 
37
-        if ($node instanceof Tag && \in_array($node->name, self::EXCLUDE)) {
37
+        if ($node instanceof Tag && \in_array($node->name, self::EXCLUDE)){
38 38
             // raw nodes
39 39
             return null;
40 40
         }
41 41
 
42 42
         $level = $this->getLevel($ctx);
43
-        if ($level === null) {
43
+        if ($level === null){
44 44
             // not available in some contexts
45 45
             return null;
46 46
         }
47 47
 
48
-        foreach ($node->nodes as $i => $child) {
49
-            if (!$child instanceof Raw) {
48
+        foreach ($node->nodes as $i => $child){
49
+            if (!$child instanceof Raw){
50 50
                 continue;
51 51
             }
52 52
 
53 53
             $position = self::BETWEEN_TAGS;
54
-            if (!isset($node->nodes[$i + 1])) {
54
+            if (!isset($node->nodes[$i + 1])){
55 55
                 $position = self::BEFORE_CLOSE;
56
-            } elseif ($node->nodes[$i + 1] instanceof PHP) {
56
+            } elseif ($node->nodes[$i + 1] instanceof PHP){
57 57
                 $position = self::BEFORE_PHP;
58 58
             }
59 59
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 
75 75
     private function indentContent(string $content, int $level, int $position = self::BETWEEN_TAGS): string
76 76
     {
77
-        if (!\str_contains($content, "\n")) {
77
+        if (!\str_contains($content, "\n")){
78 78
             // no need to do anything
79 79
             return $content;
80 80
         }
@@ -82,40 +82,40 @@  discard block
 block discarded – undo
82 82
         // we have to apply special rules to the first and the last lines
83 83
         $lines = \explode("\n", $content);
84 84
 
85
-        foreach ($lines as $i => $line) {
86
-            if (\trim($line) === '' && $i !== 0) {
85
+        foreach ($lines as $i => $line){
86
+            if (\trim($line) === '' && $i !== 0){
87 87
                 unset($lines[$i]);
88 88
             }
89 89
         }
90 90
 
91 91
         $lines = \array_values($lines);
92
-        if ($lines === []) {
92
+        if ($lines === []){
93 93
             $lines[] = '';
94 94
         }
95 95
 
96 96
         $result = '';
97
-        foreach ($lines as $i => $line) {
98
-            if (\trim($line) !== '') {
97
+        foreach ($lines as $i => $line){
98
+            if (\trim($line) !== ''){
99 99
                 $line = $i === 0 ? \rtrim($line) : \trim($line);
100 100
             }
101 101
 
102
-            if ($i !== (\count($lines) - 1)) {
103
-                $result .= $line . "\n" . \str_repeat(self::INDENT, $level);
102
+            if ($i !== (\count($lines) - 1)){
103
+                $result .= $line."\n".\str_repeat(self::INDENT, $level);
104 104
                 continue;
105 105
             }
106 106
 
107 107
             // working with last line
108
-            if ($position === self::BEFORE_PHP) {
109
-                $result .= $line . "\n";
108
+            if ($position === self::BEFORE_PHP){
109
+                $result .= $line."\n";
110 110
                 break;
111 111
             }
112 112
 
113
-            if ($position === self::BEFORE_CLOSE) {
114
-                $result .= $line . "\n" . \str_repeat(self::INDENT, max($level - 1, 0));
113
+            if ($position === self::BEFORE_CLOSE){
114
+                $result .= $line."\n".\str_repeat(self::INDENT, max($level - 1, 0));
115 115
                 break;
116 116
             }
117 117
 
118
-            $result .= $line . "\n" . \str_repeat(self::INDENT, $level);
118
+            $result .= $line."\n".\str_repeat(self::INDENT, $level);
119 119
         }
120 120
 
121 121
         return $result;
@@ -124,12 +124,12 @@  discard block
 block discarded – undo
124 124
     private function getLevel(VisitorContext $ctx): ?int
125 125
     {
126 126
         $level = 0;
127
-        foreach ($ctx->getScope() as $node) {
128
-            if ($node instanceof Attr) {
127
+        foreach ($ctx->getScope() as $node){
128
+            if ($node instanceof Attr){
129 129
                 return null;
130 130
             }
131 131
 
132
-            if ($node instanceof Block || $node instanceof Template) {
132
+            if ($node instanceof Block || $node instanceof Template){
133 133
                 continue;
134 134
             }
135 135
 
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
      */
149 149
     private function normalizeEndings(string $string, bool $joinMultiple = true): string
150 150
     {
151
-        if (!$joinMultiple) {
151
+        if (!$joinMultiple){
152 152
             return \str_replace("\r\n", "\n", $string);
153 153
         }
154 154
 
Please login to merge, or discard this patch.
Braces   +41 added lines, -20 removed lines patch added patch discarded remove patch
@@ -30,30 +30,38 @@  discard block
 block discarded – undo
30 30
 
31 31
     public function enterNode(mixed $node, VisitorContext $ctx): mixed
32 32
     {
33
-        if (!$node instanceof Template && !$node instanceof Block && !$node instanceof Tag) {
33
+        if (!$node instanceof Template && !$node instanceof Block && !$node instanceof Tag)
34
+        {
34 35
             return null;
35 36
         }
36 37
 
37
-        if ($node instanceof Tag && \in_array($node->name, self::EXCLUDE)) {
38
+        if ($node instanceof Tag && \in_array($node->name, self::EXCLUDE))
39
+        {
38 40
             // raw nodes
39 41
             return null;
40 42
         }
41 43
 
42 44
         $level = $this->getLevel($ctx);
43
-        if ($level === null) {
45
+        if ($level === null)
46
+        {
44 47
             // not available in some contexts
45 48
             return null;
46 49
         }
47 50
 
48
-        foreach ($node->nodes as $i => $child) {
49
-            if (!$child instanceof Raw) {
51
+        foreach ($node->nodes as $i => $child)
52
+        {
53
+            if (!$child instanceof Raw)
54
+            {
50 55
                 continue;
51 56
             }
52 57
 
53 58
             $position = self::BETWEEN_TAGS;
54
-            if (!isset($node->nodes[$i + 1])) {
59
+            if (!isset($node->nodes[$i + 1]))
60
+            {
55 61
                 $position = self::BEFORE_CLOSE;
56
-            } elseif ($node->nodes[$i + 1] instanceof PHP) {
62
+            }
63
+            elseif ($node->nodes[$i + 1] instanceof PHP)
64
+            {
57 65
                 $position = self::BEFORE_PHP;
58 66
             }
59 67
 
@@ -74,7 +82,8 @@  discard block
 block discarded – undo
74 82
 
75 83
     private function indentContent(string $content, int $level, int $position = self::BETWEEN_TAGS): string
76 84
     {
77
-        if (!\str_contains($content, "\n")) {
85
+        if (!\str_contains($content, "\n"))
86
+        {
78 87
             // no need to do anything
79 88
             return $content;
80 89
         }
@@ -82,35 +91,43 @@  discard block
 block discarded – undo
82 91
         // we have to apply special rules to the first and the last lines
83 92
         $lines = \explode("\n", $content);
84 93
 
85
-        foreach ($lines as $i => $line) {
86
-            if (\trim($line) === '' && $i !== 0) {
94
+        foreach ($lines as $i => $line)
95
+        {
96
+            if (\trim($line) === '' && $i !== 0)
97
+            {
87 98
                 unset($lines[$i]);
88 99
             }
89 100
         }
90 101
 
91 102
         $lines = \array_values($lines);
92
-        if ($lines === []) {
103
+        if ($lines === [])
104
+        {
93 105
             $lines[] = '';
94 106
         }
95 107
 
96 108
         $result = '';
97
-        foreach ($lines as $i => $line) {
98
-            if (\trim($line) !== '') {
109
+        foreach ($lines as $i => $line)
110
+        {
111
+            if (\trim($line) !== '')
112
+            {
99 113
                 $line = $i === 0 ? \rtrim($line) : \trim($line);
100 114
             }
101 115
 
102
-            if ($i !== (\count($lines) - 1)) {
116
+            if ($i !== (\count($lines) - 1))
117
+            {
103 118
                 $result .= $line . "\n" . \str_repeat(self::INDENT, $level);
104 119
                 continue;
105 120
             }
106 121
 
107 122
             // working with last line
108
-            if ($position === self::BEFORE_PHP) {
123
+            if ($position === self::BEFORE_PHP)
124
+            {
109 125
                 $result .= $line . "\n";
110 126
                 break;
111 127
             }
112 128
 
113
-            if ($position === self::BEFORE_CLOSE) {
129
+            if ($position === self::BEFORE_CLOSE)
130
+            {
114 131
                 $result .= $line . "\n" . \str_repeat(self::INDENT, max($level - 1, 0));
115 132
                 break;
116 133
             }
@@ -124,12 +141,15 @@  discard block
 block discarded – undo
124 141
     private function getLevel(VisitorContext $ctx): ?int
125 142
     {
126 143
         $level = 0;
127
-        foreach ($ctx->getScope() as $node) {
128
-            if ($node instanceof Attr) {
144
+        foreach ($ctx->getScope() as $node)
145
+        {
146
+            if ($node instanceof Attr)
147
+            {
129 148
                 return null;
130 149
             }
131 150
 
132
-            if ($node instanceof Block || $node instanceof Template) {
151
+            if ($node instanceof Block || $node instanceof Template)
152
+            {
133 153
                 continue;
134 154
             }
135 155
 
@@ -148,7 +168,8 @@  discard block
 block discarded – undo
148 168
      */
149 169
     private function normalizeEndings(string $string, bool $joinMultiple = true): string
150 170
     {
151
-        if (!$joinMultiple) {
171
+        if (!$joinMultiple)
172
+        {
152 173
             return \str_replace("\r\n", "\n", $string);
153 174
         }
154 175
 
Please login to merge, or discard this patch.
src/Bridge/Stempler/src/Visitor/FlattenNodes.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -22,14 +22,14 @@  discard block
 block discarded – undo
22 22
 {
23 23
     public function enterNode(mixed $node, VisitorContext $ctx): mixed
24 24
     {
25
-        if (!$node instanceof Tag) {
25
+        if (!$node instanceof Tag){
26 26
             return null;
27 27
         }
28 28
 
29 29
         $flatten = [];
30
-        foreach ($node->nodes as $child) {
31
-            if ($child instanceof Block || $child instanceof Template || $child instanceof Aggregate) {
32
-                foreach ($child->nodes as $childNode) {
30
+        foreach ($node->nodes as $child){
31
+            if ($child instanceof Block || $child instanceof Template || $child instanceof Aggregate){
32
+                foreach ($child->nodes as $childNode){
33 33
                     $flatten[] = $childNode;
34 34
                 }
35 35
                 continue;
@@ -51,12 +51,12 @@  discard block
 block discarded – undo
51 51
     private function mergeRaw(array $nodes): array
52 52
     {
53 53
         $result = [];
54
-        foreach ($nodes as $node) {
54
+        foreach ($nodes as $node){
55 55
             if (
56 56
                 $node instanceof Raw
57 57
                 && isset($result[\count($result) - 1])
58 58
                 && $result[\count($result) - 1] instanceof Raw
59
-            ) {
59
+            ){
60 60
                 $result[\count($result) - 1]->content .= $node->content;
61 61
                 continue;
62 62
             }
Please login to merge, or discard this patch.
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -22,14 +22,18 @@  discard block
 block discarded – undo
22 22
 {
23 23
     public function enterNode(mixed $node, VisitorContext $ctx): mixed
24 24
     {
25
-        if (!$node instanceof Tag) {
25
+        if (!$node instanceof Tag)
26
+        {
26 27
             return null;
27 28
         }
28 29
 
29 30
         $flatten = [];
30
-        foreach ($node->nodes as $child) {
31
-            if ($child instanceof Block || $child instanceof Template || $child instanceof Aggregate) {
32
-                foreach ($child->nodes as $childNode) {
31
+        foreach ($node->nodes as $child)
32
+        {
33
+            if ($child instanceof Block || $child instanceof Template || $child instanceof Aggregate)
34
+            {
35
+                foreach ($child->nodes as $childNode)
36
+                {
33 37
                     $flatten[] = $childNode;
34 38
                 }
35 39
                 continue;
@@ -51,7 +55,8 @@  discard block
 block discarded – undo
51 55
     private function mergeRaw(array $nodes): array
52 56
     {
53 57
         $result = [];
54
-        foreach ($nodes as $node) {
58
+        foreach ($nodes as $node)
59
+        {
55 60
             if (
56 61
                 $node instanceof Raw
57 62
                 && isset($result[\count($result) - 1])
Please login to merge, or discard this patch.
src/Bridge/Monolog/tests/RotateHandlerTest.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
         $finalizer->shouldReceive('addFinalizer')->once();
41 41
 
42 42
         $this->container->bind(ConfiguratorInterface::class, new ConfigManager(
43
-            new class() implements LoaderInterface {
43
+            new class() implements LoaderInterface{
44 44
                 public function has(string $section): bool
45 45
                 {
46 46
                     return false;
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,8 @@
 block discarded – undo
40 40
         $finalizer->shouldReceive('addFinalizer')->once();
41 41
 
42 42
         $this->container->bind(ConfiguratorInterface::class, new ConfigManager(
43
-            new class() implements LoaderInterface {
43
+            new class() implements LoaderInterface
44
+            {
44 45
                 public function has(string $section): bool
45 46
                 {
46 47
                     return false;
Please login to merge, or discard this patch.
src/Bridge/Monolog/tests/LoggerTest.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
     public function testLoggerShouldBeReset()
26 26
     {
27 27
         $this->container->bind(ConfiguratorInterface::class, new ConfigManager(
28
-            new class() implements LoaderInterface {
28
+            new class() implements LoaderInterface{
29 29
                 public function has(string $section): bool
30 30
                 {
31 31
                     return false;
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,8 @@
 block discarded – undo
25 25
     public function testLoggerShouldBeReset()
26 26
     {
27 27
         $this->container->bind(ConfiguratorInterface::class, new ConfigManager(
28
-            new class() implements LoaderInterface {
28
+            new class() implements LoaderInterface
29
+            {
29 30
                 public function has(string $section): bool
30 31
                 {
31 32
                     return false;
Please login to merge, or discard this patch.
src/Bridge/Monolog/tests/FactoryTest.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 
30 30
     public function testDefaultLogger(): void
31 31
     {
32
-        $factory = new LogFactory(new MonologConfig([]), new ListenerRegistry(),$this->container);
32
+        $factory = new LogFactory(new MonologConfig([]), new ListenerRegistry(), $this->container);
33 33
         $logger = $factory->getLogger();
34 34
 
35 35
         $this->assertNotEmpty($logger);
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
         $logger = $factory->getLogger();
55 55
 
56 56
         $this->container->bind(ConfiguratorInterface::class, new ConfigManager(
57
-            new class() implements LoaderInterface {
57
+            new class() implements LoaderInterface{
58 58
                 public function has(string $section): bool
59 59
                 {
60 60
                     return false;
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
     public function testFinalizerShouldResetDefaultLogger()
81 81
     {
82 82
         $this->container->bind(ConfiguratorInterface::class, new ConfigManager(
83
-            new class() implements LoaderInterface {
83
+            new class() implements LoaderInterface{
84 84
                 public function has(string $section): bool
85 85
                 {
86 86
                     return false;
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
     public function testFinalizerShouldNotResetLoggerWhenApplicationTerminating()
121 121
     {
122 122
         $this->container->bind(ConfiguratorInterface::class, new ConfigManager(
123
-            new class() implements LoaderInterface {
123
+            new class() implements LoaderInterface{
124 124
                 public function has(string $section): bool
125 125
                 {
126 126
                     return false;
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -54,7 +54,8 @@  discard block
 block discarded – undo
54 54
         $logger = $factory->getLogger();
55 55
 
56 56
         $this->container->bind(ConfiguratorInterface::class, new ConfigManager(
57
-            new class() implements LoaderInterface {
57
+            new class() implements LoaderInterface
58
+            {
58 59
                 public function has(string $section): bool
59 60
                 {
60 61
                     return false;
@@ -80,7 +81,8 @@  discard block
 block discarded – undo
80 81
     public function testFinalizerShouldResetDefaultLogger()
81 82
     {
82 83
         $this->container->bind(ConfiguratorInterface::class, new ConfigManager(
83
-            new class() implements LoaderInterface {
84
+            new class() implements LoaderInterface
85
+            {
84 86
                 public function has(string $section): bool
85 87
                 {
86 88
                     return false;
@@ -120,7 +122,8 @@  discard block
 block discarded – undo
120 122
     public function testFinalizerShouldNotResetLoggerWhenApplicationTerminating()
121 123
     {
122 124
         $this->container->bind(ConfiguratorInterface::class, new ConfigManager(
123
-            new class() implements LoaderInterface {
125
+            new class() implements LoaderInterface
126
+            {
124 127
                 public function has(string $section): bool
125 128
                 {
126 129
                     return false;
Please login to merge, or discard this patch.