Passed
Push — master ( ccffb6...f76682 )
by butschster
15:36 queued 17s
created
src/Stempler/tests/BufferTest.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
     public function testIterate(): void
26 26
     {
27 27
         $out = '';
28
-        foreach ($this->buffer('abc') as $n) {
28
+        foreach ($this->buffer('abc') as $n){
29 29
             $out .= $n->char;
30 30
         }
31 31
 
@@ -149,14 +149,14 @@  discard block
 block discarded – undo
149 149
 
150 150
     private function generate(StreamInterface $src)
151 151
     {
152
-        while (!$src->isEOI()) {
152
+        while (!$src->isEOI()){
153 153
             yield new Byte($src->getOffset(), $src->peak());
154 154
         }
155 155
     }
156 156
 
157 157
     private function generateToken(StreamInterface $src): \Generator
158 158
     {
159
-        while (!$src->isEOI()) {
159
+        while (!$src->isEOI()){
160 160
             yield new Token(0, null, $src->peak());
161 161
         }
162 162
     }
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -25,7 +25,8 @@  discard block
 block discarded – undo
25 25
     public function testIterate(): void
26 26
     {
27 27
         $out = '';
28
-        foreach ($this->buffer('abc') as $n) {
28
+        foreach ($this->buffer('abc') as $n)
29
+        {
29 30
             $out .= $n->char;
30 31
         }
31 32
 
@@ -149,14 +150,16 @@  discard block
 block discarded – undo
149 150
 
150 151
     private function generate(StreamInterface $src)
151 152
     {
152
-        while (!$src->isEOI()) {
153
+        while (!$src->isEOI())
154
+        {
153 155
             yield new Byte($src->getOffset(), $src->peak());
154 156
         }
155 157
     }
156 158
 
157 159
     private function generateToken(StreamInterface $src): \Generator
158 160
     {
159
-        while (!$src->isEOI()) {
161
+        while (!$src->isEOI())
162
+        {
160 163
             yield new Token(0, null, $src->peak());
161 164
         }
162 165
     }
Please login to merge, or discard this patch.
src/Stempler/src/Lexer/Buffer.php 2 patches
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
         /** @internal */
20 20
         private readonly \Generator $generator,
21 21
         private int $offset = 0
22
-    ) {
22
+    ){
23 23
     }
24 24
 
25 25
     /**
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
      */
31 31
     public function getIterator(): \Traversable
32 32
     {
33
-        while ($n = $this->next()) {
33
+        while ($n = $this->next()){
34 34
             yield $n;
35 35
         }
36 36
     }
@@ -40,20 +40,20 @@  discard block
 block discarded – undo
40 40
         return $this->offset;
41 41
     }
42 42
 
43
-    public function next(): Byte|Token|null
43
+    public function next(): Byte | Token | null
44 44
     {
45
-        if ($this->replay !== []) {
45
+        if ($this->replay !== []){
46 46
             $n = \array_shift($this->replay);
47
-        } else {
47
+        }else{
48 48
             $n = $this->generator->current();
49
-            if ($n === null) {
49
+            if ($n === null){
50 50
                 return null;
51 51
             }
52 52
             $this->generator->next();
53 53
             $this->buffer[] = $n;
54 54
         }
55 55
 
56
-        if ($n !== null && $n->offset !== null) {
56
+        if ($n !== null && $n->offset !== null){
57 57
             $this->offset = $n->offset;
58 58
         }
59 59
 
@@ -66,10 +66,10 @@  discard block
 block discarded – undo
66 66
     public function nextBytes(): string
67 67
     {
68 68
         $result = '';
69
-        while ($n = $this->next()) {
70
-            if ($n instanceof Byte) {
69
+        while ($n = $this->next()){
70
+            if ($n instanceof Byte){
71 71
                 $result .= $n->char;
72
-            } else {
72
+            }else{
73 73
                 break;
74 74
             }
75 75
         }
@@ -80,14 +80,14 @@  discard block
 block discarded – undo
80 80
     /**
81 81
      * Get next generator value without advancing the position.
82 82
      */
83
-    public function lookahead(): Byte|Token|null
83
+    public function lookahead(): Byte | Token | null
84 84
     {
85
-        if ($this->replay !== []) {
85
+        if ($this->replay !== []){
86 86
             return $this->replay[0];
87 87
         }
88 88
 
89 89
         $n = $this->next();
90
-        if ($n !== null) {
90
+        if ($n !== null){
91 91
             \array_unshift($this->replay, $n);
92 92
         }
93 93
 
@@ -103,20 +103,20 @@  discard block
 block discarded – undo
103 103
     {
104 104
         $result = '';
105 105
         $replay = [];
106
-        for ($i = 0; $i < $size; $i++) {
106
+        for ($i = 0; $i < $size; $i++){
107 107
             $n = $this->next();
108
-            if ($n !== null) {
108
+            if ($n !== null){
109 109
                 $replay[] = $n;
110 110
             }
111 111
 
112
-            if (!$n instanceof Byte) {
112
+            if (!$n instanceof Byte){
113 113
                 break;
114 114
             }
115 115
 
116 116
             $result .= $n->char;
117 117
         }
118 118
 
119
-        foreach (\array_reverse($replay) as $n) {
119
+        foreach (\array_reverse($replay) as $n){
120 120
             \array_unshift($this->replay, $n);
121 121
         }
122 122
 
@@ -128,8 +128,8 @@  discard block
 block discarded – undo
128 128
      */
129 129
     public function replay(int $offset): void
130 130
     {
131
-        foreach ($this->buffer as $n) {
132
-            if ($n->offset > $offset) {
131
+        foreach ($this->buffer as $n){
132
+            if ($n->offset > $offset){
133 133
                 $this->replay[] = $n;
134 134
             }
135 135
         }
Please login to merge, or discard this patch.
Braces   +34 added lines, -16 removed lines patch added patch discarded remove patch
@@ -30,7 +30,8 @@  discard block
 block discarded – undo
30 30
      */
31 31
     public function getIterator(): \Traversable
32 32
     {
33
-        while ($n = $this->next()) {
33
+        while ($n = $this->next())
34
+        {
34 35
             yield $n;
35 36
         }
36 37
     }
@@ -42,18 +43,23 @@  discard block
 block discarded – undo
42 43
 
43 44
     public function next(): Byte|Token|null
44 45
     {
45
-        if ($this->replay !== []) {
46
+        if ($this->replay !== [])
47
+        {
46 48
             $n = \array_shift($this->replay);
47
-        } else {
49
+        }
50
+        else
51
+        {
48 52
             $n = $this->generator->current();
49
-            if ($n === null) {
53
+            if ($n === null)
54
+            {
50 55
                 return null;
51 56
             }
52 57
             $this->generator->next();
53 58
             $this->buffer[] = $n;
54 59
         }
55 60
 
56
-        if ($n !== null && $n->offset !== null) {
61
+        if ($n !== null && $n->offset !== null)
62
+        {
57 63
             $this->offset = $n->offset;
58 64
         }
59 65
 
@@ -66,10 +72,14 @@  discard block
 block discarded – undo
66 72
     public function nextBytes(): string
67 73
     {
68 74
         $result = '';
69
-        while ($n = $this->next()) {
70
-            if ($n instanceof Byte) {
75
+        while ($n = $this->next())
76
+        {
77
+            if ($n instanceof Byte)
78
+            {
71 79
                 $result .= $n->char;
72
-            } else {
80
+            }
81
+            else
82
+            {
73 83
                 break;
74 84
             }
75 85
         }
@@ -82,12 +92,14 @@  discard block
 block discarded – undo
82 92
      */
83 93
     public function lookahead(): Byte|Token|null
84 94
     {
85
-        if ($this->replay !== []) {
95
+        if ($this->replay !== [])
96
+        {
86 97
             return $this->replay[0];
87 98
         }
88 99
 
89 100
         $n = $this->next();
90
-        if ($n !== null) {
101
+        if ($n !== null)
102
+        {
91 103
             \array_unshift($this->replay, $n);
92 104
         }
93 105
 
@@ -103,20 +115,24 @@  discard block
 block discarded – undo
103 115
     {
104 116
         $result = '';
105 117
         $replay = [];
106
-        for ($i = 0; $i < $size; $i++) {
118
+        for ($i = 0; $i < $size; $i++)
119
+        {
107 120
             $n = $this->next();
108
-            if ($n !== null) {
121
+            if ($n !== null)
122
+            {
109 123
                 $replay[] = $n;
110 124
             }
111 125
 
112
-            if (!$n instanceof Byte) {
126
+            if (!$n instanceof Byte)
127
+            {
113 128
                 break;
114 129
             }
115 130
 
116 131
             $result .= $n->char;
117 132
         }
118 133
 
119
-        foreach (\array_reverse($replay) as $n) {
134
+        foreach (\array_reverse($replay) as $n)
135
+        {
120 136
             \array_unshift($this->replay, $n);
121 137
         }
122 138
 
@@ -128,8 +144,10 @@  discard block
 block discarded – undo
128 144
      */
129 145
     public function replay(int $offset): void
130 146
     {
131
-        foreach ($this->buffer as $n) {
132
-            if ($n->offset > $offset) {
147
+        foreach ($this->buffer as $n)
148
+        {
149
+            if ($n->offset > $offset)
150
+            {
133 151
                 $this->replay[] = $n;
134 152
             }
135 153
         }
Please login to merge, or discard this patch.
src/Events/src/Processor/AttributeProcessor.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -22,29 +22,29 @@  discard block
 block discarded – undo
22 22
         private readonly ReaderInterface $reader,
23 23
         private readonly ListenerFactoryInterface $factory,
24 24
         private readonly ?ListenerRegistryInterface $registry = null,
25
-    ) {
25
+    ){
26 26
         // Look for Spiral\Events\Attribute\Listener attribute only when ListenerRegistry provided by container
27
-        if ($this->registry !== null) {
27
+        if ($this->registry !== null){
28 28
             $listenerRegistry->addListener($this);
29 29
         }
30 30
     }
31 31
 
32 32
     public function process(): void
33 33
     {
34
-        if ($this->registry === null) {
34
+        if ($this->registry === null){
35 35
             return;
36 36
         }
37 37
 
38
-        if (!$this->collected) {
38
+        if (!$this->collected){
39 39
             throw new \RuntimeException(\sprintf('Tokenizer did not finalize %s listener.', self::class));
40 40
         }
41 41
 
42
-        foreach ($this->attributes as $listener => $attributes) {
43
-            foreach ($attributes as $attribute) {
42
+        foreach ($this->attributes as $listener => $attributes){
43
+            foreach ($attributes as $attribute){
44 44
                 $method = $this->getMethod($listener, $attribute->method ?? '__invoke');
45 45
 
46 46
                 $events = (array)($attribute->event ?? $this->getEventFromTypeDeclaration($method));
47
-                foreach ($events as $event) {
47
+                foreach ($events as $event){
48 48
                     $this->registry->addListener(
49 49
                         event: $event,
50 50
                         listener: $this->factory->create($listener, $method->getName()),
@@ -59,14 +59,14 @@  discard block
 block discarded – undo
59 59
     {
60 60
         $attrs = $this->reader->getClassMetadata($class, Listener::class);
61 61
 
62
-        foreach ($attrs as $attr) {
62
+        foreach ($attrs as $attr){
63 63
             $this->attributes[$class->getName()][] = $attr;
64 64
         }
65 65
 
66
-        foreach ($class->getMethods() as $method) {
66
+        foreach ($class->getMethods() as $method){
67 67
             $attrs = $this->reader->getFunctionMetadata($method, Listener::class);
68 68
 
69
-            foreach ($attrs as $attr) {
69
+            foreach ($attrs as $attr){
70 70
                 $attr->method = $method->getName();
71 71
                 $this->attributes[$class->getName()][] = $attr;
72 72
             }
Please login to merge, or discard this patch.
Braces   +18 added lines, -9 removed lines patch added patch discarded remove patch
@@ -24,27 +24,33 @@  discard block
 block discarded – undo
24 24
         private readonly ?ListenerRegistryInterface $registry = null,
25 25
     ) {
26 26
         // Look for Spiral\Events\Attribute\Listener attribute only when ListenerRegistry provided by container
27
-        if ($this->registry !== null) {
27
+        if ($this->registry !== null)
28
+        {
28 29
             $listenerRegistry->addListener($this);
29 30
         }
30 31
     }
31 32
 
32 33
     public function process(): void
33 34
     {
34
-        if ($this->registry === null) {
35
+        if ($this->registry === null)
36
+        {
35 37
             return;
36 38
         }
37 39
 
38
-        if (!$this->collected) {
40
+        if (!$this->collected)
41
+        {
39 42
             throw new \RuntimeException(\sprintf('Tokenizer did not finalize %s listener.', self::class));
40 43
         }
41 44
 
42
-        foreach ($this->attributes as $listener => $attributes) {
43
-            foreach ($attributes as $attribute) {
45
+        foreach ($this->attributes as $listener => $attributes)
46
+        {
47
+            foreach ($attributes as $attribute)
48
+            {
44 49
                 $method = $this->getMethod($listener, $attribute->method ?? '__invoke');
45 50
 
46 51
                 $events = (array)($attribute->event ?? $this->getEventFromTypeDeclaration($method));
47
-                foreach ($events as $event) {
52
+                foreach ($events as $event)
53
+                {
48 54
                     $this->registry->addListener(
49 55
                         event: $event,
50 56
                         listener: $this->factory->create($listener, $method->getName()),
@@ -59,14 +65,17 @@  discard block
 block discarded – undo
59 65
     {
60 66
         $attrs = $this->reader->getClassMetadata($class, Listener::class);
61 67
 
62
-        foreach ($attrs as $attr) {
68
+        foreach ($attrs as $attr)
69
+        {
63 70
             $this->attributes[$class->getName()][] = $attr;
64 71
         }
65 72
 
66
-        foreach ($class->getMethods() as $method) {
73
+        foreach ($class->getMethods() as $method)
74
+        {
67 75
             $attrs = $this->reader->getFunctionMetadata($method, Listener::class);
68 76
 
69
-            foreach ($attrs as $attr) {
77
+            foreach ($attrs as $attr)
78
+            {
70 79
                 $attr->method = $method->getName();
71 80
                 $this->attributes[$class->getName()][] = $attr;
72 81
             }
Please login to merge, or discard this patch.
src/Bridge/Stempler/src/StemplerEngine.php 2 patches
Braces   +51 added lines, -24 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,13 +77,15 @@  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
 
83 85
         // since view source support pre-processing we must ensure that context is always set
84 86
         $loader = $this->builder->getLoader();
85
-        if ($loader instanceof StemplerLoader) {
87
+        if ($loader instanceof StemplerLoader)
88
+        {
86 89
             $loader->setContext($context);
87 90
         }
88 91
 
@@ -100,20 +103,27 @@  discard block
 block discarded – undo
100 103
         // cache key
101 104
         $key = $this->cacheKey($view, $context);
102 105
 
103
-        if ($this->cache !== null && $this->cache->isFresh($key)) {
106
+        if ($this->cache !== null && $this->cache->isFresh($key))
107
+        {
104 108
             $this->cache->load($key);
105
-        } elseif (!\class_exists($class)) {
106
-            try {
109
+        }
110
+        elseif (!\class_exists($class))
111
+        {
112
+            try
113
+            {
107 114
                 $builder = $this->getBuilder($context);
108 115
 
109 116
                 $result = $builder->compile($path);
110
-            } catch (Throwable $e) {
117
+            }
118
+            catch (Throwable $e)
119
+            {
111 120
                 throw new CompileException($e);
112 121
             }
113 122
 
114 123
             $compiled = $this->compileClass($class, $result);
115 124
 
116
-            if ($this->cache !== null) {
125
+            if ($this->cache !== null)
126
+            {
117 127
                 $this->cache->write(
118 128
                     $key,
119 129
                     $compiled,
@@ -126,13 +136,15 @@  discard block
 block discarded – undo
126 136
                 $this->cache->load($key);
127 137
             }
128 138
 
129
-            if (!\class_exists($class)) {
139
+            if (!\class_exists($class))
140
+            {
130 141
                 // runtime initialization
131 142
                 eval('?>' . $compiled);
132 143
             }
133 144
         }
134 145
 
135
-        if (!\class_exists($class) || !\is_subclass_of($class, ViewInterface::class)) {
146
+        if (!\class_exists($class) || !\is_subclass_of($class, ViewInterface::class))
147
+        {
136 148
             throw new EngineException(\sprintf('Unable to load `%s`, cache might be corrupted.', $path));
137 149
         }
138 150
 
@@ -141,7 +153,8 @@  discard block
 block discarded – undo
141 153
 
142 154
     public function reset(string $path, ContextInterface $context): void
143 155
     {
144
-        if ($this->cache === null) {
156
+        if ($this->cache === null)
157
+        {
145 158
             return;
146 159
         }
147 160
 
@@ -160,12 +173,15 @@  discard block
 block discarded – undo
160 173
      */
161 174
     public function makeSourceMap(string $path, ContextInterface $context): ?SourceMap
162 175
     {
163
-        try {
176
+        try
177
+        {
164 178
             $builder = $this->getBuilder($context);
165 179
 
166 180
             // there is no need to cache sourcemaps since they are used during the exception only
167 181
             return $builder->compile($path)->getSourceMap($builder->getLoader());
168
-        } catch (Throwable) {
182
+        }
183
+        catch (Throwable)
184
+        {
169 185
             return null;
170 186
         }
171 187
     }
@@ -222,7 +238,8 @@  discard block
 block discarded – undo
222 238
         $builder = new Builder($loader);
223 239
 
224 240
         $directivesGroup = new DirectiveGroup();
225
-        foreach ($this->getDirectives() as $directive) {
241
+        foreach ($this->getDirectives() as $directive)
242
+        {
226 243
             $directivesGroup->addDirective($directive);
227 244
         }
228 245
 
@@ -253,7 +270,8 @@  discard block
 block discarded – undo
253 270
         $builder->getCompiler()->addRenderer(new DynamicRenderer(new DirectiveGroup($this->getDirectives())));
254 271
 
255 272
         // ATS modifications
256
-        foreach ($this->getVisitors(Builder::STAGE_PREPARE) as $visitor) {
273
+        foreach ($this->getVisitors(Builder::STAGE_PREPARE) as $visitor)
274
+        {
257 275
             $builder->addVisitor($visitor, Builder::STAGE_PREPARE);
258 276
         }
259 277
 
@@ -266,15 +284,18 @@  discard block
 block discarded – undo
266 284
         $builder->addVisitor(new ResolveImports($builder), Builder::STAGE_TRANSFORM);
267 285
         $builder->addVisitor(new ExtendsParent($builder), Builder::STAGE_TRANSFORM);
268 286
 
269
-        foreach ($this->getVisitors(Builder::STAGE_TRANSFORM) as $visitor) {
287
+        foreach ($this->getVisitors(Builder::STAGE_TRANSFORM) as $visitor)
288
+        {
270 289
             $builder->addVisitor($visitor, Builder::STAGE_TRANSFORM);
271 290
         }
272 291
 
273
-        foreach ($this->getVisitors(Builder::STAGE_FINALIZE) as $visitor) {
292
+        foreach ($this->getVisitors(Builder::STAGE_FINALIZE) as $visitor)
293
+        {
274 294
             $builder->addVisitor($visitor, Builder::STAGE_FINALIZE);
275 295
         }
276 296
 
277
-        foreach ($this->getVisitors(Builder::STAGE_COMPILE) as $visitor) {
297
+        foreach ($this->getVisitors(Builder::STAGE_COMPILE) as $visitor)
298
+        {
278 299
             $builder->addVisitor($visitor, Builder::STAGE_COMPILE);
279 300
         }
280 301
 
@@ -287,8 +308,10 @@  discard block
 block discarded – undo
287 308
     private function getVisitors(int $stage): iterable
288 309
     {
289 310
         $result = [];
290
-        foreach ($this->config->getVisitors($stage) as $visitor) {
291
-            if ($visitor instanceof Autowire) {
311
+        foreach ($this->config->getVisitors($stage) as $visitor)
312
+        {
313
+            if ($visitor instanceof Autowire)
314
+            {
292 315
                 $result[] = $visitor->resolve($this->container->get(FactoryInterface::class));
293 316
                 continue;
294 317
             }
@@ -305,8 +328,10 @@  discard block
 block discarded – undo
305 328
     private function getProcessors(): iterable
306 329
     {
307 330
         $result = [];
308
-        foreach ($this->config->getProcessors() as $processor) {
309
-            if ($processor instanceof Autowire) {
331
+        foreach ($this->config->getProcessors() as $processor)
332
+        {
333
+            if ($processor instanceof Autowire)
334
+            {
310 335
                 $result[] = $processor->resolve($this->container->get(FactoryInterface::class));
311 336
                 continue;
312 337
             }
@@ -323,8 +348,10 @@  discard block
 block discarded – undo
323 348
     private function getDirectives(): iterable
324 349
     {
325 350
         $result = [];
326
-        foreach ($this->config->getDirectives() as $directive) {
327
-            if ($directive instanceof Autowire) {
351
+        foreach ($this->config->getDirectives() as $directive)
352
+        {
353
+            if ($directive instanceof Autowire)
354
+            {
328 355
                 $result[] = $directive->resolve($this->container->get(FactoryInterface::class));
329 356
                 continue;
330 357
             }
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 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,13 +76,13 @@  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
 
83 83
         // since view source support pre-processing we must ensure that context is always set
84 84
         $loader = $this->builder->getLoader();
85
-        if ($loader instanceof StemplerLoader) {
85
+        if ($loader instanceof StemplerLoader){
86 86
             $loader->setContext($context);
87 87
         }
88 88
 
@@ -100,20 +100,20 @@  discard block
 block discarded – undo
100 100
         // cache key
101 101
         $key = $this->cacheKey($view, $context);
102 102
 
103
-        if ($this->cache !== null && $this->cache->isFresh($key)) {
103
+        if ($this->cache !== null && $this->cache->isFresh($key)){
104 104
             $this->cache->load($key);
105
-        } elseif (!\class_exists($class)) {
106
-            try {
105
+        } elseif (!\class_exists($class)){
106
+            try{
107 107
                 $builder = $this->getBuilder($context);
108 108
 
109 109
                 $result = $builder->compile($path);
110
-            } catch (Throwable $e) {
110
+            }catch (Throwable $e){
111 111
                 throw new CompileException($e);
112 112
             }
113 113
 
114 114
             $compiled = $this->compileClass($class, $result);
115 115
 
116
-            if ($this->cache !== null) {
116
+            if ($this->cache !== null){
117 117
                 $this->cache->write(
118 118
                     $key,
119 119
                     $compiled,
@@ -126,13 +126,13 @@  discard block
 block discarded – undo
126 126
                 $this->cache->load($key);
127 127
             }
128 128
 
129
-            if (!\class_exists($class)) {
129
+            if (!\class_exists($class)){
130 130
                 // runtime initialization
131
-                eval('?>' . $compiled);
131
+                eval('?>'.$compiled);
132 132
             }
133 133
         }
134 134
 
135
-        if (!\class_exists($class) || !\is_subclass_of($class, ViewInterface::class)) {
135
+        if (!\class_exists($class) || !\is_subclass_of($class, ViewInterface::class)){
136 136
             throw new EngineException(\sprintf('Unable to load `%s`, cache might be corrupted.', $path));
137 137
         }
138 138
 
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 
142 142
     public function reset(string $path, ContextInterface $context): void
143 143
     {
144
-        if ($this->cache === null) {
144
+        if ($this->cache === null){
145 145
             return;
146 146
         }
147 147
 
@@ -160,12 +160,12 @@  discard block
 block discarded – undo
160 160
      */
161 161
     public function makeSourceMap(string $path, ContextInterface $context): ?SourceMap
162 162
     {
163
-        try {
163
+        try{
164 164
             $builder = $this->getBuilder($context);
165 165
 
166 166
             // there is no need to cache sourcemaps since they are used during the exception only
167 167
             return $builder->compile($path)->getSourceMap($builder->getLoader());
168
-        } catch (Throwable) {
168
+        }catch (Throwable){
169 169
             return null;
170 170
         }
171 171
     }
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
      */
202 202
     private function className(ViewSource $source, ContextInterface $context): string
203 203
     {
204
-        return $this->classPrefix . $this->cacheKey($source, $context);
204
+        return $this->classPrefix.$this->cacheKey($source, $context);
205 205
     }
206 206
 
207 207
     private function cacheKey(ViewSource $source, ContextInterface $context): string
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
         $builder = new Builder($loader);
222 222
 
223 223
         $directivesGroup = new DirectiveGroup();
224
-        foreach ($this->getDirectives() as $directive) {
224
+        foreach ($this->getDirectives() as $directive){
225 225
             $directivesGroup->addDirective($directive);
226 226
         }
227 227
 
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
         $builder->getCompiler()->addRenderer(new DynamicRenderer(new DirectiveGroup($this->getDirectives())));
253 253
 
254 254
         // ATS modifications
255
-        foreach ($this->getVisitors(Builder::STAGE_PREPARE) as $visitor) {
255
+        foreach ($this->getVisitors(Builder::STAGE_PREPARE) as $visitor){
256 256
             $builder->addVisitor($visitor, Builder::STAGE_PREPARE);
257 257
         }
258 258
 
@@ -265,15 +265,15 @@  discard block
 block discarded – undo
265 265
         $builder->addVisitor(new ResolveImports($builder), Builder::STAGE_TRANSFORM);
266 266
         $builder->addVisitor(new ExtendsParent($builder), Builder::STAGE_TRANSFORM);
267 267
 
268
-        foreach ($this->getVisitors(Builder::STAGE_TRANSFORM) as $visitor) {
268
+        foreach ($this->getVisitors(Builder::STAGE_TRANSFORM) as $visitor){
269 269
             $builder->addVisitor($visitor, Builder::STAGE_TRANSFORM);
270 270
         }
271 271
 
272
-        foreach ($this->getVisitors(Builder::STAGE_FINALIZE) as $visitor) {
272
+        foreach ($this->getVisitors(Builder::STAGE_FINALIZE) as $visitor){
273 273
             $builder->addVisitor($visitor, Builder::STAGE_FINALIZE);
274 274
         }
275 275
 
276
-        foreach ($this->getVisitors(Builder::STAGE_COMPILE) as $visitor) {
276
+        foreach ($this->getVisitors(Builder::STAGE_COMPILE) as $visitor){
277 277
             $builder->addVisitor($visitor, Builder::STAGE_COMPILE);
278 278
         }
279 279
 
@@ -286,8 +286,8 @@  discard block
 block discarded – undo
286 286
     private function getVisitors(int $stage): iterable
287 287
     {
288 288
         $result = [];
289
-        foreach ($this->config->getVisitors($stage) as $visitor) {
290
-            if ($visitor instanceof Autowire) {
289
+        foreach ($this->config->getVisitors($stage) as $visitor){
290
+            if ($visitor instanceof Autowire){
291 291
                 $result[] = $visitor->resolve($this->container->get(FactoryInterface::class));
292 292
                 continue;
293 293
             }
@@ -304,8 +304,8 @@  discard block
 block discarded – undo
304 304
     private function getProcessors(): iterable
305 305
     {
306 306
         $result = [];
307
-        foreach ($this->config->getProcessors() as $processor) {
308
-            if ($processor instanceof Autowire) {
307
+        foreach ($this->config->getProcessors() as $processor){
308
+            if ($processor instanceof Autowire){
309 309
                 $result[] = $processor->resolve($this->container->get(FactoryInterface::class));
310 310
                 continue;
311 311
             }
@@ -322,8 +322,8 @@  discard block
 block discarded – undo
322 322
     private function getDirectives(): iterable
323 323
     {
324 324
         $result = [];
325
-        foreach ($this->config->getDirectives() as $directive) {
326
-            if ($directive instanceof Autowire) {
325
+        foreach ($this->config->getDirectives() as $directive){
326
+            if ($directive instanceof Autowire){
327 327
                 $result[] = $directive->resolve($this->container->get(FactoryInterface::class));
328 328
                 continue;
329 329
             }
Please login to merge, or discard this patch.
src/Boot/tests/KernelTest.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
             'root' => __DIR__,
43 43
         ])->run();
44 44
 
45
-        $d = new class() implements DispatcherInterface {
45
+        $d = new class() implements DispatcherInterface{
46 46
             public $fired = false;
47 47
 
48 48
             public function canServe(): bool
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
             'root' => __DIR__,
72 72
         ])->run();
73 73
 
74
-        $d = new class() implements DispatcherInterface {
74
+        $d = new class() implements DispatcherInterface{
75 75
             public function canServe(): bool
76 76
             {
77 77
                 return true;
@@ -109,19 +109,19 @@  discard block
 block discarded – undo
109 109
             'root' => __DIR__,
110 110
         ]);
111 111
 
112
-        $kernel->booting(static function (TestCore $core) {
112
+        $kernel->booting(static function (TestCore $core){
113 113
             $core->getContainer()->bind('abc', 'foo');
114 114
         });
115 115
 
116
-        $kernel->booting(static function (TestCore $core) {
116
+        $kernel->booting(static function (TestCore $core){
117 117
             $core->getContainer()->bind('bcd', 'foo');
118 118
         });
119 119
 
120
-        $kernel->booted( static function (TestCore $core) {
120
+        $kernel->booted(static function (TestCore $core){
121 121
             $core->getContainer()->bind('cde', 'foo');
122 122
         });
123 123
 
124
-        $kernel->booted( static function (TestCore $core) {
124
+        $kernel->booted(static function (TestCore $core){
125 125
             $core->getContainer()->bind('def', 'foo');
126 126
         });
127 127
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 
145 145
     public function testEventsShouldBeDispatched(): void
146 146
     {
147
-        $testDispatcher = new class implements DispatcherInterface {
147
+        $testDispatcher = new class implements DispatcherInterface{
148 148
             public function canServe(): bool
149 149
             {
150 150
                 return true;
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
         };
157 157
 
158 158
         $container = new Container();
159
-        $kernel = TestCore::create(directories: ['root' => __DIR__,], container: $container)
159
+        $kernel = TestCore::create(directories: ['root' => __DIR__, ], container: $container)
160 160
             ->addDispatcher($testDispatcher);
161 161
 
162 162
         $dispatcher = $this->createMock(EventDispatcherInterface::class);
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
     public function testDispatcherNotFoundEventShouldBeDispatched(): void
178 178
     {
179 179
         $container = new Container();
180
-        $kernel = TestCore::create(directories: ['root' => __DIR__,], container: $container);
180
+        $kernel = TestCore::create(directories: ['root' => __DIR__, ], container: $container);
181 181
 
182 182
         $dispatcher = $this->createMock(EventDispatcherInterface::class);
183 183
         $dispatcher
Please login to merge, or discard this patch.
Braces   +14 added lines, -7 removed lines patch added patch discarded remove patch
@@ -42,7 +42,8 @@  discard block
 block discarded – undo
42 42
             'root' => __DIR__,
43 43
         ])->run();
44 44
 
45
-        $d = new class() implements DispatcherInterface {
45
+        $d = new class() implements DispatcherInterface
46
+        {
46 47
             public $fired = false;
47 48
 
48 49
             public function canServe(): bool
@@ -71,7 +72,8 @@  discard block
 block discarded – undo
71 72
             'root' => __DIR__,
72 73
         ])->run();
73 74
 
74
-        $d = new class() implements DispatcherInterface {
75
+        $d = new class() implements DispatcherInterface
76
+        {
75 77
             public function canServe(): bool
76 78
             {
77 79
                 return true;
@@ -109,19 +111,23 @@  discard block
 block discarded – undo
109 111
             'root' => __DIR__,
110 112
         ]);
111 113
 
112
-        $kernel->booting(static function (TestCore $core) {
114
+        $kernel->booting(static function (TestCore $core)
115
+        {
113 116
             $core->getContainer()->bind('abc', 'foo');
114 117
         });
115 118
 
116
-        $kernel->booting(static function (TestCore $core) {
119
+        $kernel->booting(static function (TestCore $core)
120
+        {
117 121
             $core->getContainer()->bind('bcd', 'foo');
118 122
         });
119 123
 
120
-        $kernel->booted( static function (TestCore $core) {
124
+        $kernel->booted( static function (TestCore $core)
125
+        {
121 126
             $core->getContainer()->bind('cde', 'foo');
122 127
         });
123 128
 
124
-        $kernel->booted( static function (TestCore $core) {
129
+        $kernel->booted( static function (TestCore $core)
130
+        {
125 131
             $core->getContainer()->bind('def', 'foo');
126 132
         });
127 133
 
@@ -144,7 +150,8 @@  discard block
 block discarded – undo
144 150
 
145 151
     public function testEventsShouldBeDispatched(): void
146 152
     {
147
-        $testDispatcher = new class implements DispatcherInterface {
153
+        $testDispatcher = new class implements DispatcherInterface
154
+        {
148 155
             public function canServe(): bool
149 156
             {
150 157
                 return true;
Please login to merge, or discard this patch.
src/Validation/src/ValidationProvider.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 
16 16
     public function __construct(
17 17
         private readonly InvokerInterface $invoker
18
-    ) {
18
+    ){
19 19
     }
20 20
 
21 21
     /**
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
      */
32 32
     public function getValidation(string $name, array $params = []): ValidationInterface
33 33
     {
34
-        if (!isset($this->resolvers[$name])) {
34
+        if (!isset($this->resolvers[$name])){
35 35
             throw new ValidationException(\sprintf('Validation with name `%s` is not registered.', $name));
36 36
         }
37 37
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,8 @@
 block discarded – undo
31 31
      */
32 32
     public function getValidation(string $name, array $params = []): ValidationInterface
33 33
     {
34
-        if (!isset($this->resolvers[$name])) {
34
+        if (!isset($this->resolvers[$name]))
35
+        {
35 36
             throw new ValidationException(\sprintf('Validation with name `%s` is not registered.', $name));
36 37
         }
37 38
 
Please login to merge, or discard this patch.
src/Validation/src/Bootloader/ValidationBootloader.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 
27 27
     public function __construct(
28 28
         private readonly ConfiguratorInterface $config
29
-    ) {
29
+    ){
30 30
     }
31 31
 
32 32
     public function init(): void
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
      */
42 42
     public function setDefaultValidator(string $name): void
43 43
     {
44
-        if ($this->config->getConfig(ValidationConfig::CONFIG)['defaultValidator'] === null) {
44
+        if ($this->config->getConfig(ValidationConfig::CONFIG)['defaultValidator'] === null){
45 45
             $this->config->modify(ValidationConfig::CONFIG, new Set('defaultValidator', $name));
46 46
         }
47 47
     }
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
         ValidationConfig $config,
54 54
         ValidationProviderInterface $provider
55 55
     ): ValidationInterface {
56
-        if ($config->getDefaultValidator() === null) {
56
+        if ($config->getDefaultValidator() === null){
57 57
             throw new ValidationException('Default Validator is not configured.');
58 58
         }
59 59
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,7 +41,8 @@  discard block
 block discarded – undo
41 41
      */
42 42
     public function setDefaultValidator(string $name): void
43 43
     {
44
-        if ($this->config->getConfig(ValidationConfig::CONFIG)['defaultValidator'] === null) {
44
+        if ($this->config->getConfig(ValidationConfig::CONFIG)['defaultValidator'] === null)
45
+        {
45 46
             $this->config->modify(ValidationConfig::CONFIG, new Set('defaultValidator', $name));
46 47
         }
47 48
     }
@@ -53,7 +54,8 @@  discard block
 block discarded – undo
53 54
         ValidationConfig $config,
54 55
         ValidationProviderInterface $provider
55 56
     ): ValidationInterface {
56
-        if ($config->getDefaultValidator() === null) {
57
+        if ($config->getDefaultValidator() === null)
58
+        {
57 59
             throw new ValidationException('Default Validator is not configured.');
58 60
         }
59 61
 
Please login to merge, or discard this patch.
src/Framework/Filter/ValidationHandlerMiddleware.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -27,15 +27,15 @@
 block discarded – undo
27 27
     public function __construct(
28 28
         ContainerInterface $container,
29 29
         ?ErrorsRendererInterface $renderErrors = null
30
-    ) {
30
+    ){
31 31
         $this->renderErrors = $renderErrors ?? $container->get(JsonErrorsRenderer::class);
32 32
     }
33 33
 
34 34
     public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
35 35
     {
36
-        try {
36
+        try{
37 37
             return $handler->handle($request);
38
-        } catch (ValidationException $e) {
38
+        }catch (ValidationException $e){
39 39
             return $this->renderErrors->render($e->errors, $e->context);
40 40
         }
41 41
     }
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,9 +33,12 @@
 block discarded – undo
33 33
 
34 34
     public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
35 35
     {
36
-        try {
36
+        try
37
+        {
37 38
             return $handler->handle($request);
38
-        } catch (ValidationException $e) {
39
+        }
40
+        catch (ValidationException $e)
41
+        {
39 42
             return $this->renderErrors->render($e->errors, $e->context);
40 43
         }
41 44
     }
Please login to merge, or discard this patch.
src/Framework/Filter/JsonErrorsRenderer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
 {
13 13
     public function __construct(
14 14
         private readonly ResponseWrapper $wrapper
15
-    ) {
15
+    ){
16 16
     }
17 17
 
18 18
     public function render(array $errors, mixed $context = null): ResponseInterface
Please login to merge, or discard this patch.