Passed
Pull Request — master (#736)
by Abdul Malik
07:17 queued 45s
created
src/Stempler/src/Parser/Syntax/InlineSyntax.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
      */
32 32
     public function handle(Parser $parser, Assembler $asm, Token $token): void
33 33
     {
34
-        switch ($token->type) {
34
+        switch ($token->type){
35 35
             case InlineGrammar::TYPE_OPEN_TAG:
36 36
                 $this->inline = new Inline(new Context($token, $parser->getPath()));
37 37
                 $asm->push($this->inline);
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 handle(Parser $parser, Assembler $asm, Token $token): void
33 33
     {
34
-        switch ($token->type) {
34
+        switch ($token->type)
35
+        {
35 36
             case InlineGrammar::TYPE_OPEN_TAG:
36 37
                 $this->inline = new Inline(new Context($token, $parser->getPath()));
37 38
                 $asm->push($this->inline);
Please login to merge, or discard this patch.
src/Stempler/src/Traverser.php 2 patches
Braces   +48 added lines, -24 removed lines patch added patch discarded remove patch
@@ -29,7 +29,8 @@  discard block
 block discarded – undo
29 29
 
30 30
     public function __construct(array $visitors = [])
31 31
     {
32
-        foreach ($visitors as $visitor) {
32
+        foreach ($visitors as $visitor)
33
+        {
33 34
             $this->addVisitor($visitor);
34 35
         }
35 36
     }
@@ -44,8 +45,10 @@  discard block
 block discarded – undo
44 45
 
45 46
     public function removeVisitor(VisitorInterface $visitor): void
46 47
     {
47
-        foreach ($this->visitors as $index => $added) {
48
-            if ($added === $visitor) {
48
+        foreach ($this->visitors as $index => $added)
49
+        {
50
+            if ($added === $visitor)
51
+            {
49 52
                 unset($this->visitors[$index]);
50 53
                 break;
51 54
             }
@@ -64,22 +67,27 @@  discard block
 block discarded – undo
64 67
         $context ??= new VisitorContext();
65 68
 
66 69
         $ctx = clone $context;
67
-        foreach ($nodes as $index => $node) {
68
-            if ($this->stopTraversal) {
70
+        foreach ($nodes as $index => $node)
71
+        {
72
+            if ($this->stopTraversal)
73
+            {
69 74
                 break;
70 75
             }
71 76
 
72 77
             $traverseChildren = true;
73 78
             $breakVisitorID = null;
74 79
 
75
-            if ($node instanceof NodeInterface) {
80
+            if ($node instanceof NodeInterface)
81
+            {
76 82
                 $ctx = $context->withNode($node);
77 83
             }
78 84
 
79
-            foreach ($this->visitors as $visitorID => $visitor) {
85
+            foreach ($this->visitors as $visitorID => $visitor)
86
+            {
80 87
                 $result = $visitor->enterNode($node, $ctx);
81 88
 
82
-                switch (true) {
89
+                switch (true)
90
+                {
83 91
                     case $result === null:
84 92
                         break;
85 93
 
@@ -109,17 +117,21 @@  discard block
 block discarded – undo
109 117
             }
110 118
 
111 119
             // sub nodes
112
-            if ($traverseChildren && $node instanceof NodeInterface) {
120
+            if ($traverseChildren && $node instanceof NodeInterface)
121
+            {
113 122
                 $nodes[$index] = $this->traverseNode($node, $ctx);
114
-                if ($this->stopTraversal) {
123
+                if ($this->stopTraversal)
124
+                {
115 125
                     break;
116 126
                 }
117 127
             }
118 128
 
119
-            foreach ($this->visitors as $visitorID => $visitor) {
129
+            foreach ($this->visitors as $visitorID => $visitor)
130
+            {
120 131
                 $result = $visitor->leaveNode($node, $ctx);
121 132
 
122
-                switch (true) {
133
+                switch (true)
134
+                {
123 135
                     case $result === null:
124 136
                         break;
125 137
 
@@ -141,7 +153,8 @@  discard block
 block discarded – undo
141 153
                         );
142 154
                 }
143 155
 
144
-                if ($breakVisitorID === $visitorID) {
156
+                if ($breakVisitorID === $visitorID)
157
+                {
145 158
                     break;
146 159
                 }
147 160
             }
@@ -156,18 +169,22 @@  discard block
 block discarded – undo
156 169
     private function traverseNode(NodeInterface $node, VisitorContext $context): NodeInterface
157 170
     {
158 171
         $ctx = clone $context;
159
-        foreach ($node as $name => $_) {
172
+        foreach ($node as $name => $_)
173
+        {
160 174
             $child = &$node->$name;
161
-            if (is_array($child)) {
175
+            if (is_array($child))
176
+            {
162 177
                 $child = $this->traverse($child, $ctx);
163
-                if ($this->stopTraversal) {
178
+                if ($this->stopTraversal)
179
+                {
164 180
                     break;
165 181
                 }
166 182
 
167 183
                 continue;
168 184
             }
169 185
 
170
-            if (!$child instanceof NodeInterface) {
186
+            if (!$child instanceof NodeInterface)
187
+            {
171 188
                 continue;
172 189
             }
173 190
 
@@ -176,9 +193,11 @@  discard block
 block discarded – undo
176 193
             $traverseChildren = true;
177 194
             $breakVisitorID = null;
178 195
 
179
-            foreach ($this->visitors as $visitorID => $visitor) {
196
+            foreach ($this->visitors as $visitorID => $visitor)
197
+            {
180 198
                 $result = $visitor->enterNode($child, $ctx);
181
-                switch (true) {
199
+                switch (true)
200
+                {
182 201
                     case $result === null:
183 202
                         break;
184 203
 
@@ -206,17 +225,21 @@  discard block
 block discarded – undo
206 225
                 }
207 226
             }
208 227
 
209
-            if ($traverseChildren) {
228
+            if ($traverseChildren)
229
+            {
210 230
                 $child = $this->traverseNode($child, $ctx);
211
-                if ($this->stopTraversal) {
231
+                if ($this->stopTraversal)
232
+                {
212 233
                     break;
213 234
                 }
214 235
             }
215 236
 
216
-            foreach ($this->visitors as $visitorID => $visitor) {
237
+            foreach ($this->visitors as $visitorID => $visitor)
238
+            {
217 239
                 $result = $visitor->leaveNode($child, $ctx);
218 240
 
219
-                switch (true) {
241
+                switch (true)
242
+                {
220 243
                     case $result === null:
221 244
                         break;
222 245
 
@@ -234,7 +257,8 @@  discard block
 block discarded – undo
234 257
                         );
235 258
                 }
236 259
 
237
-                if ($breakVisitorID === $visitorID) {
260
+                if ($breakVisitorID === $visitorID)
261
+                {
238 262
                     break;
239 263
                 }
240 264
             }
Please login to merge, or discard this patch.
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 
28 28
     public function __construct(array $visitors = [])
29 29
     {
30
-        foreach ($visitors as $visitor) {
30
+        foreach ($visitors as $visitor){
31 31
             $this->addVisitor($visitor);
32 32
         }
33 33
     }
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
 
43 43
     public function removeVisitor(VisitorInterface $visitor): void
44 44
     {
45
-        foreach ($this->visitors as $index => $added) {
46
-            if ($added === $visitor) {
45
+        foreach ($this->visitors as $index => $added){
46
+            if ($added === $visitor){
47 47
                 unset($this->visitors[$index]);
48 48
                 break;
49 49
             }
@@ -62,22 +62,22 @@  discard block
 block discarded – undo
62 62
         $context ??= new VisitorContext();
63 63
 
64 64
         $ctx = clone $context;
65
-        foreach ($nodes as $index => $node) {
66
-            if ($this->stopTraversal) {
65
+        foreach ($nodes as $index => $node){
66
+            if ($this->stopTraversal){
67 67
                 break;
68 68
             }
69 69
 
70 70
             $traverseChildren = true;
71 71
             $breakVisitorID = null;
72 72
 
73
-            if ($node instanceof NodeInterface) {
73
+            if ($node instanceof NodeInterface){
74 74
                 $ctx = $context->withNode($node);
75 75
             }
76 76
 
77
-            foreach ($this->visitors as $visitorID => $visitor) {
77
+            foreach ($this->visitors as $visitorID => $visitor){
78 78
                 $result = $visitor->enterNode($node, $ctx);
79 79
 
80
-                switch (true) {
80
+                switch (true){
81 81
                     case $result === null:
82 82
                         break;
83 83
 
@@ -101,23 +101,23 @@  discard block
 block discarded – undo
101 101
 
102 102
                     default:
103 103
                         throw new \LogicException(
104
-                            'enterNode() returned invalid value of type ' . gettype($result)
104
+                            'enterNode() returned invalid value of type '.gettype($result)
105 105
                         );
106 106
                 }
107 107
             }
108 108
 
109 109
             // sub nodes
110
-            if ($traverseChildren && $node instanceof NodeInterface) {
110
+            if ($traverseChildren && $node instanceof NodeInterface){
111 111
                 $nodes[$index] = $this->traverseNode($node, $ctx);
112
-                if ($this->stopTraversal) {
112
+                if ($this->stopTraversal){
113 113
                     break;
114 114
                 }
115 115
             }
116 116
 
117
-            foreach ($this->visitors as $visitorID => $visitor) {
117
+            foreach ($this->visitors as $visitorID => $visitor){
118 118
                 $result = $visitor->leaveNode($node, $ctx);
119 119
 
120
-                switch (true) {
120
+                switch (true){
121 121
                     case $result === null:
122 122
                         break;
123 123
 
@@ -135,11 +135,11 @@  discard block
 block discarded – undo
135 135
 
136 136
                     default:
137 137
                         throw new \LogicException(
138
-                            'leaveNode() returned invalid value of type ' . gettype($result)
138
+                            'leaveNode() returned invalid value of type '.gettype($result)
139 139
                         );
140 140
                 }
141 141
 
142
-                if ($breakVisitorID === $visitorID) {
142
+                if ($breakVisitorID === $visitorID){
143 143
                     break;
144 144
                 }
145 145
             }
@@ -154,18 +154,18 @@  discard block
 block discarded – undo
154 154
     private function traverseNode(NodeInterface $node, VisitorContext $context): NodeInterface
155 155
     {
156 156
         $ctx = clone $context;
157
-        foreach ($node as $name => $_) {
157
+        foreach ($node as $name => $_){
158 158
             $child = &$node->$name;
159
-            if (is_array($child)) {
159
+            if (is_array($child)){
160 160
                 $child = $this->traverse($child, $ctx);
161
-                if ($this->stopTraversal) {
161
+                if ($this->stopTraversal){
162 162
                     break;
163 163
                 }
164 164
 
165 165
                 continue;
166 166
             }
167 167
 
168
-            if (!$child instanceof NodeInterface) {
168
+            if (!$child instanceof NodeInterface){
169 169
                 continue;
170 170
             }
171 171
 
@@ -174,9 +174,9 @@  discard block
 block discarded – undo
174 174
             $traverseChildren = true;
175 175
             $breakVisitorID = null;
176 176
 
177
-            foreach ($this->visitors as $visitorID => $visitor) {
177
+            foreach ($this->visitors as $visitorID => $visitor){
178 178
                 $result = $visitor->enterNode($child, $ctx);
179
-                switch (true) {
179
+                switch (true){
180 180
                     case $result === null:
181 181
                         break;
182 182
 
@@ -199,22 +199,22 @@  discard block
 block discarded – undo
199 199
 
200 200
                     default:
201 201
                         throw new \LogicException(
202
-                            'enterNode() returned invalid value of type ' . gettype($result)
202
+                            'enterNode() returned invalid value of type '.gettype($result)
203 203
                         );
204 204
                 }
205 205
             }
206 206
 
207
-            if ($traverseChildren) {
207
+            if ($traverseChildren){
208 208
                 $child = $this->traverseNode($child, $ctx);
209
-                if ($this->stopTraversal) {
209
+                if ($this->stopTraversal){
210 210
                     break;
211 211
                 }
212 212
             }
213 213
 
214
-            foreach ($this->visitors as $visitorID => $visitor) {
214
+            foreach ($this->visitors as $visitorID => $visitor){
215 215
                 $result = $visitor->leaveNode($child, $ctx);
216 216
 
217
-                switch (true) {
217
+                switch (true){
218 218
                     case $result === null:
219 219
                         break;
220 220
 
@@ -228,11 +228,11 @@  discard block
 block discarded – undo
228 228
 
229 229
                     default:
230 230
                         throw new \LogicException(
231
-                            'leaveNode() returned invalid value of type ' . gettype($result)
231
+                            'leaveNode() returned invalid value of type '.gettype($result)
232 232
                         );
233 233
                 }
234 234
 
235
-                if ($breakVisitorID === $visitorID) {
235
+                if ($breakVisitorID === $visitorID){
236 236
                     break;
237 237
                 }
238 238
             }
Please login to merge, or discard this patch.
src/Stempler/src/Compiler/Renderer/HTMLRenderer.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
      */
29 29
     public function render(Compiler $compiler, Result $result, NodeInterface $node): bool
30 30
     {
31
-        switch (true) {
31
+        switch (true){
32 32
             case $node instanceof Tag:
33 33
                 $this->tag($compiler, $result, $node);
34 34
                 return true;
@@ -50,8 +50,8 @@  discard block
 block discarded – undo
50 50
     {
51 51
         $result->push(sprintf('<%s', $node->name), $node->getContext());
52 52
 
53
-        foreach ($node->attrs as $attr) {
54
-            if (!$attr instanceof Attribute) {
53
+        foreach ($node->attrs as $attr){
54
+            if (!$attr instanceof Attribute){
55 55
                 $compiler->compile($attr, $result);
56 56
                 continue;
57 57
             }
@@ -61,30 +61,30 @@  discard block
 block discarded – undo
61 61
 
62 62
         $result->push(sprintf('%s>', $node->void ? '/' : ''), null);
63 63
 
64
-        foreach ($node->nodes as $child) {
64
+        foreach ($node->nodes as $child){
65 65
             $compiler->compile($child, $result);
66 66
         }
67 67
 
68
-        if (!$node->void) {
68
+        if (!$node->void){
69 69
             $result->push(sprintf('</%s>', $node->name), null);
70 70
         }
71 71
     }
72 72
 
73 73
     private function attribute(Compiler $compiler, Result $result, Attr $node): void
74 74
     {
75
-        if ($node->name instanceof NodeInterface) {
75
+        if ($node->name instanceof NodeInterface){
76 76
             $result->push(' ', null);
77 77
             $compiler->compile($node->name, $result);
78
-        } else {
78
+        }else{
79 79
             $result->push(sprintf(' %s', $node->name), $node->getContext());
80 80
         }
81 81
 
82 82
         $value = $node->value;
83
-        if ($value instanceof Nil) {
83
+        if ($value instanceof Nil){
84 84
             return;
85 85
         }
86 86
 
87
-        if ($value instanceof NodeInterface) {
87
+        if ($value instanceof NodeInterface){
88 88
             $result->push('=', null);
89 89
             $compiler->compile($value, $result);
90 90
             return;
@@ -95,8 +95,8 @@  discard block
 block discarded – undo
95 95
 
96 96
     private function verbatim(Compiler $compiler, Result $result, Verbatim $node): void
97 97
     {
98
-        foreach ($node->nodes as $child) {
99
-            if (is_string($child)) {
98
+        foreach ($node->nodes as $child){
99
+            if (is_string($child)){
100 100
                 $result->push($child, null);
101 101
                 continue;
102 102
             }
Please login to merge, or discard this patch.
Braces   +23 added lines, -11 removed lines patch added patch discarded remove patch
@@ -28,7 +28,8 @@  discard block
 block discarded – undo
28 28
      */
29 29
     public function render(Compiler $compiler, Result $result, NodeInterface $node): bool
30 30
     {
31
-        switch (true) {
31
+        switch (true)
32
+        {
32 33
             case $node instanceof Tag:
33 34
                 $this->tag($compiler, $result, $node);
34 35
                 return true;
@@ -50,8 +51,10 @@  discard block
 block discarded – undo
50 51
     {
51 52
         $result->push(sprintf('<%s', $node->name), $node->getContext());
52 53
 
53
-        foreach ($node->attrs as $attr) {
54
-            if (!$attr instanceof Attribute) {
54
+        foreach ($node->attrs as $attr)
55
+        {
56
+            if (!$attr instanceof Attribute)
57
+            {
55 58
                 $compiler->compile($attr, $result);
56 59
                 continue;
57 60
             }
@@ -61,30 +64,37 @@  discard block
 block discarded – undo
61 64
 
62 65
         $result->push(sprintf('%s>', $node->void ? '/' : ''), null);
63 66
 
64
-        foreach ($node->nodes as $child) {
67
+        foreach ($node->nodes as $child)
68
+        {
65 69
             $compiler->compile($child, $result);
66 70
         }
67 71
 
68
-        if (!$node->void) {
72
+        if (!$node->void)
73
+        {
69 74
             $result->push(sprintf('</%s>', $node->name), null);
70 75
         }
71 76
     }
72 77
 
73 78
     private function attribute(Compiler $compiler, Result $result, Attr $node): void
74 79
     {
75
-        if ($node->name instanceof NodeInterface) {
80
+        if ($node->name instanceof NodeInterface)
81
+        {
76 82
             $result->push(' ', null);
77 83
             $compiler->compile($node->name, $result);
78
-        } else {
84
+        }
85
+        else
86
+        {
79 87
             $result->push(sprintf(' %s', $node->name), $node->getContext());
80 88
         }
81 89
 
82 90
         $value = $node->value;
83
-        if ($value instanceof Nil) {
91
+        if ($value instanceof Nil)
92
+        {
84 93
             return;
85 94
         }
86 95
 
87
-        if ($value instanceof NodeInterface) {
96
+        if ($value instanceof NodeInterface)
97
+        {
88 98
             $result->push('=', null);
89 99
             $compiler->compile($value, $result);
90 100
             return;
@@ -95,8 +105,10 @@  discard block
 block discarded – undo
95 105
 
96 106
     private function verbatim(Compiler $compiler, Result $result, Verbatim $node): void
97 107
     {
98
-        foreach ($node->nodes as $child) {
99
-            if (is_string($child)) {
108
+        foreach ($node->nodes as $child)
109
+        {
110
+            if (is_string($child))
111
+            {
100 112
                 $result->push($child, null);
101 113
                 continue;
102 114
             }
Please login to merge, or discard this patch.
src/Stempler/src/Compiler/Renderer/DynamicRenderer.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
     public function __construct(
33 33
         DirectiveRendererInterface $directiveRenderer = null,
34 34
         string $defaultFilter = self::DEFAULT_FILTER
35
-    ) {
35
+    ){
36 36
         $this->directiveRenderer = $directiveRenderer;
37 37
         $this->defaultFilter = $defaultFilter;
38 38
     }
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
      */
43 43
     public function render(Compiler $compiler, Result $result, NodeInterface $node): bool
44 44
     {
45
-        switch (true) {
45
+        switch (true){
46 46
             case $node instanceof Output:
47 47
                 $this->output($result, $node);
48 48
                 return true;
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
      */
61 61
     private function directive(Result $source, Directive $directive): void
62 62
     {
63
-        if ($this->directiveRenderer !== null) {
63
+        if ($this->directiveRenderer !== null){
64 64
             $result = $this->directiveRenderer->render($directive);
65
-            if ($result !== null) {
65
+            if ($result !== null){
66 66
                 $source->push($result, $directive->getContext());
67 67
                 return;
68 68
             }
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 
77 77
     private function output(Result $source, Output $output): void
78 78
     {
79
-        if ($output->rawOutput) {
79
+        if ($output->rawOutput){
80 80
             $source->push(sprintf('<?php echo %s; ?>', trim($output->body)), $output->getContext());
81 81
             return;
82 82
         }
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -42,7 +42,8 @@  discard block
 block discarded – undo
42 42
      */
43 43
     public function render(Compiler $compiler, Result $result, NodeInterface $node): bool
44 44
     {
45
-        switch (true) {
45
+        switch (true)
46
+        {
46 47
             case $node instanceof Output:
47 48
                 $this->output($result, $node);
48 49
                 return true;
@@ -60,9 +61,11 @@  discard block
 block discarded – undo
60 61
      */
61 62
     private function directive(Result $source, Directive $directive): void
62 63
     {
63
-        if ($this->directiveRenderer !== null) {
64
+        if ($this->directiveRenderer !== null)
65
+        {
64 66
             $result = $this->directiveRenderer->render($directive);
65
-            if ($result !== null) {
67
+            if ($result !== null)
68
+            {
66 69
                 $source->push($result, $directive->getContext());
67 70
                 return;
68 71
             }
@@ -76,7 +79,8 @@  discard block
 block discarded – undo
76 79
 
77 80
     private function output(Result $source, Output $output): void
78 81
     {
79
-        if ($output->rawOutput) {
82
+        if ($output->rawOutput)
83
+        {
80 84
             $source->push(sprintf('<?php echo %s; ?>', trim($output->body)), $output->getContext());
81 85
             return;
82 86
         }
Please login to merge, or discard this patch.
src/Stempler/src/Compiler/Renderer/CoreRenderer.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
         Result $result,
33 33
         NodeInterface $node
34 34
     ): bool {
35
-        switch (true) {
35
+        switch (true){
36 36
             case $node instanceof Hidden:
37 37
                 return true;
38 38
 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
                 $result->withinContext(
41 41
                     $node->getContext(),
42 42
                     function (Result $source) use ($node, $compiler): void {
43
-                        foreach ($node->nodes as $child) {
43
+                        foreach ($node->nodes as $child){
44 44
                             $compiler->compile($child, $source);
45 45
                         }
46 46
                     }
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
                 $result->withinContext(
53 53
                     $node->getContext(),
54 54
                     function (Result $source) use ($node, $compiler): void {
55
-                        foreach ($node->nodes as $child) {
56
-                            if (is_string($child)) {
55
+                        foreach ($node->nodes as $child){
56
+                            if (is_string($child)){
57 57
                                 $source->push($child, null);
58 58
                                 continue;
59 59
                             }
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,7 +32,8 @@  discard block
 block discarded – undo
32 32
         Result $result,
33 33
         NodeInterface $node
34 34
     ): bool {
35
-        switch (true) {
35
+        switch (true)
36
+        {
36 37
             case $node instanceof Hidden:
37 38
                 return true;
38 39
 
@@ -40,7 +41,8 @@  discard block
 block discarded – undo
40 41
                 $result->withinContext(
41 42
                     $node->getContext(),
42 43
                     function (Result $source) use ($node, $compiler): void {
43
-                        foreach ($node->nodes as $child) {
44
+                        foreach ($node->nodes as $child)
45
+                        {
44 46
                             $compiler->compile($child, $source);
45 47
                         }
46 48
                     }
@@ -52,8 +54,10 @@  discard block
 block discarded – undo
52 54
                 $result->withinContext(
53 55
                     $node->getContext(),
54 56
                     function (Result $source) use ($node, $compiler): void {
55
-                        foreach ($node->nodes as $child) {
56
-                            if (is_string($child)) {
57
+                        foreach ($node->nodes as $child)
58
+                        {
59
+                            if (is_string($child))
60
+                            {
57 61
                                 $source->push($child, null);
58 62
                                 continue;
59 63
                             }
Please login to merge, or discard this patch.
src/Stempler/src/Compiler/Renderer/PHPRenderer.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
      */
25 25
     public function render(Compiler $compiler, Result $result, NodeInterface $node): bool
26 26
     {
27
-        if ($node instanceof PHP) {
27
+        if ($node instanceof PHP){
28 28
             $result->push($node->content, $node->getContext());
29 29
             return true;
30 30
         }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,8 @@
 block discarded – undo
24 24
      */
25 25
     public function render(Compiler $compiler, Result $result, NodeInterface $node): bool
26 26
     {
27
-        if ($node instanceof PHP) {
27
+        if ($node instanceof PHP)
28
+        {
28 29
             $result->push($node->content, $node->getContext());
29 30
             return true;
30 31
         }
Please login to merge, or discard this patch.
src/Stempler/src/Compiler.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -37,16 +37,16 @@
 block discarded – undo
37 37
     {
38 38
         $result ??= new Result();
39 39
 
40
-        if (is_array($node)) {
41
-            foreach ($node as $child) {
40
+        if (is_array($node)){
41
+            foreach ($node as $child){
42 42
                 $this->compile($child, $result);
43 43
             }
44 44
 
45 45
             return $result;
46 46
         }
47 47
 
48
-        foreach ($this->renders as $renderer) {
49
-            if ($renderer->render($this, $result, $node)) {
48
+        foreach ($this->renders as $renderer){
49
+            if ($renderer->render($this, $result, $node)){
50 50
                 return $result;
51 51
             }
52 52
         }
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -37,16 +37,20 @@
 block discarded – undo
37 37
     {
38 38
         $result ??= new Result();
39 39
 
40
-        if (is_array($node)) {
41
-            foreach ($node as $child) {
40
+        if (is_array($node))
41
+        {
42
+            foreach ($node as $child)
43
+            {
42 44
                 $this->compile($child, $result);
43 45
             }
44 46
 
45 47
             return $result;
46 48
         }
47 49
 
48
-        foreach ($this->renders as $renderer) {
49
-            if ($renderer->render($this, $result, $node)) {
50
+        foreach ($this->renders as $renderer)
51
+        {
52
+            if ($renderer->render($this, $result, $node))
53
+            {
50 54
                 return $result;
51 55
             }
52 56
         }
Please login to merge, or discard this patch.
src/Stempler/src/Transform/Visitor/DefineBlocks.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -32,13 +32,13 @@  discard block
 block discarded – undo
32 32
      */
33 33
     public function enterNode($node, VisitorContext $ctx)
34 34
     {
35
-        if ($node instanceof Tag) {
35
+        if ($node instanceof Tag){
36 36
             return $this->makeBlock($node);
37 37
         }
38 38
 
39
-        if ($node instanceof Inline) {
39
+        if ($node instanceof Inline){
40 40
             $block = new Block($node->name, $node->getContext());
41
-            if ($node->value !== null) {
41
+            if ($node->value !== null){
42 42
                 $block->nodes[] = new Raw($node->value);
43 43
             }
44 44
 
@@ -61,14 +61,14 @@  discard block
 block discarded – undo
61 61
     private function makeBlock(Tag $node): ?NodeInterface
62 62
     {
63 63
         $name = null;
64
-        foreach ($this->prefix as $prefix) {
65
-            if (strpos($node->name, (string) $prefix) === 0) {
64
+        foreach ($this->prefix as $prefix){
65
+            if (strpos($node->name, (string)$prefix) === 0){
66 66
                 $name = substr($node->name, strlen($prefix));
67 67
                 break;
68 68
             }
69 69
         }
70 70
 
71
-        if ($name === null) {
71
+        if ($name === null){
72 72
             return null;
73 73
         }
74 74
 
Please login to merge, or discard this patch.
Braces   +12 added lines, -6 removed lines patch added patch discarded remove patch
@@ -32,13 +32,16 @@  discard block
 block discarded – undo
32 32
      */
33 33
     public function enterNode($node, VisitorContext $ctx)
34 34
     {
35
-        if ($node instanceof Tag) {
35
+        if ($node instanceof Tag)
36
+        {
36 37
             return $this->makeBlock($node);
37 38
         }
38 39
 
39
-        if ($node instanceof Inline) {
40
+        if ($node instanceof Inline)
41
+        {
40 42
             $block = new Block($node->name, $node->getContext());
41
-            if ($node->value !== null) {
43
+            if ($node->value !== null)
44
+            {
42 45
                 $block->nodes[] = new Raw($node->value);
43 46
             }
44 47
 
@@ -61,14 +64,17 @@  discard block
 block discarded – undo
61 64
     private function makeBlock(Tag $node): ?NodeInterface
62 65
     {
63 66
         $name = null;
64
-        foreach ($this->prefix as $prefix) {
65
-            if (strpos($node->name, (string) $prefix) === 0) {
67
+        foreach ($this->prefix as $prefix)
68
+        {
69
+            if (strpos($node->name, (string) $prefix) === 0)
70
+            {
66 71
                 $name = substr($node->name, strlen($prefix));
67 72
                 break;
68 73
             }
69 74
         }
70 75
 
71
-        if ($name === null) {
76
+        if ($name === null)
77
+        {
72 78
             return null;
73 79
         }
74 80
 
Please login to merge, or discard this patch.
src/Stempler/src/Lexer/Grammar/Traits/TokenTrait.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -27,11 +27,11 @@  discard block
 block discarded – undo
27 27
         $buffer = null;
28 28
         $bufferOffset = 0;
29 29
 
30
-        foreach ($inner as $n) {
30
+        foreach ($inner as $n){
31 31
             $token->offset ??= $n->offset;
32 32
 
33
-            if ($n instanceof Byte) {
34
-                if ($buffer === null) {
33
+            if ($n instanceof Byte){
34
+                if ($buffer === null){
35 35
                     $buffer = '';
36 36
                     $bufferOffset = $n->offset;
37 37
                 }
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
                 continue;
43 43
             }
44 44
 
45
-            if ($buffer !== null) {
45
+            if ($buffer !== null){
46 46
                 $token->tokens[] = new Token(
47 47
                     Token::TYPE_RAW,
48 48
                     $bufferOffset,
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
             $token->tokens[] = $n;
57 57
         }
58 58
 
59
-        if ($buffer !== null) {
59
+        if ($buffer !== null){
60 60
             $token->tokens[] = new Token(
61 61
                 Token::TYPE_RAW,
62 62
                 $bufferOffset,
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
             );
66 66
         }
67 67
 
68
-        if (count($token->tokens) === 1 && $token->tokens[0]->type === Token::TYPE_RAW) {
68
+        if (count($token->tokens) === 1 && $token->tokens[0]->type === Token::TYPE_RAW){
69 69
             $token->tokens = [];
70 70
         }
71 71
 
Please login to merge, or discard this patch.
Braces   +12 added lines, -6 removed lines patch added patch discarded remove patch
@@ -27,11 +27,14 @@  discard block
 block discarded – undo
27 27
         $buffer = null;
28 28
         $bufferOffset = 0;
29 29
 
30
-        foreach ($inner as $n) {
30
+        foreach ($inner as $n)
31
+        {
31 32
             $token->offset ??= $n->offset;
32 33
 
33
-            if ($n instanceof Byte) {
34
-                if ($buffer === null) {
34
+            if ($n instanceof Byte)
35
+            {
36
+                if ($buffer === null)
37
+                {
35 38
                     $buffer = '';
36 39
                     $bufferOffset = $n->offset;
37 40
                 }
@@ -42,7 +45,8 @@  discard block
 block discarded – undo
42 45
                 continue;
43 46
             }
44 47
 
45
-            if ($buffer !== null) {
48
+            if ($buffer !== null)
49
+            {
46 50
                 $token->tokens[] = new Token(
47 51
                     Token::TYPE_RAW,
48 52
                     $bufferOffset,
@@ -56,7 +60,8 @@  discard block
 block discarded – undo
56 60
             $token->tokens[] = $n;
57 61
         }
58 62
 
59
-        if ($buffer !== null) {
63
+        if ($buffer !== null)
64
+        {
60 65
             $token->tokens[] = new Token(
61 66
                 Token::TYPE_RAW,
62 67
                 $bufferOffset,
@@ -65,7 +70,8 @@  discard block
 block discarded – undo
65 70
             );
66 71
         }
67 72
 
68
-        if (count($token->tokens) === 1 && $token->tokens[0]->type === Token::TYPE_RAW) {
73
+        if (count($token->tokens) === 1 && $token->tokens[0]->type === Token::TYPE_RAW)
74
+        {
69 75
             $token->tokens = [];
70 76
         }
71 77
 
Please login to merge, or discard this patch.