Passed
Pull Request — master (#1182)
by Aleksei
10:25
created
src/Stempler/src/Builder.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
         private readonly LoaderInterface $loader,
36 36
         private readonly Parser $parser = new Parser(),
37 37
         private readonly Compiler $compiler = new Compiler()
38
-    ) {
38
+    ){
39 39
     }
40 40
 
41 41
     public function getLoader(): LoaderInterface
@@ -80,14 +80,14 @@  discard block
 block discarded – undo
80 80
      */
81 81
     public function compileTemplate(Template $tpl): Result
82 82
     {
83
-        try {
84
-            if (isset($this->visitors[self::STAGE_COMPILE])) {
83
+        try{
84
+            if (isset($this->visitors[self::STAGE_COMPILE])){
85 85
                 $traverser = new Traverser($this->visitors[self::STAGE_COMPILE]);
86 86
                 $tpl = $traverser->traverse([$tpl])[0];
87 87
             }
88 88
 
89 89
             return $this->compiler->compile($tpl);
90
-        } catch (CompilerException $e) {
90
+        }catch (CompilerException $e){
91 91
             throw $this->mapException($e);
92 92
         }
93 93
     }
@@ -100,21 +100,21 @@  discard block
 block discarded – undo
100 100
         $source = $this->loader->load($path);
101 101
         $stream = new StringStream($source->getContent());
102 102
 
103
-        try {
103
+        try{
104 104
             $tpl = $this->parser->withPath($path)->parse($stream);
105 105
             $tpl->setContext(new Context(
106 106
                 new Token(Token::TYPE_RAW, 0, ''),
107 107
                 $path
108 108
             ));
109
-        } catch (ParserException $e) {
109
+        }catch (ParserException $e){
110 110
             throw $this->mapException($e);
111 111
         }
112 112
 
113
-        try {
113
+        try{
114 114
             return $this->process($tpl);
115
-        } catch (ContextExceptionInterface $e) {
115
+        }catch (ContextExceptionInterface $e){
116 116
             throw $this->mapException($e);
117
-        } catch (\Throwable $e) {
117
+        }catch (\Throwable $e){
118 118
             throw $e;
119 119
         }
120 120
     }
@@ -124,17 +124,17 @@  discard block
 block discarded – undo
124 124
      */
125 125
     private function process(Template $template): Template
126 126
     {
127
-        if (isset($this->visitors[self::STAGE_PREPARE])) {
127
+        if (isset($this->visitors[self::STAGE_PREPARE])){
128 128
             $traverser = new Traverser($this->visitors[self::STAGE_PREPARE]);
129 129
             $template = $traverser->traverse([$template])[0];
130 130
         }
131 131
 
132
-        if (isset($this->visitors[self::STAGE_TRANSFORM])) {
132
+        if (isset($this->visitors[self::STAGE_TRANSFORM])){
133 133
             $traverser = new Traverser($this->visitors[self::STAGE_TRANSFORM]);
134 134
             $template = $traverser->traverse([$template])[0];
135 135
         }
136 136
 
137
-        if (isset($this->visitors[self::STAGE_FINALIZE])) {
137
+        if (isset($this->visitors[self::STAGE_FINALIZE])){
138 138
             $traverser = new Traverser($this->visitors[self::STAGE_FINALIZE]);
139 139
             $template = $traverser->traverse([$template])[0];
140 140
         }
@@ -147,17 +147,17 @@  discard block
 block discarded – undo
147 147
      */
148 148
     private function mapException(ContextExceptionInterface $e): ContextExceptionInterface
149 149
     {
150
-        if ($e->getContext()->getPath() === null) {
150
+        if ($e->getContext()->getPath() === null){
151 151
             return $e;
152 152
         }
153 153
 
154
-        try {
154
+        try{
155 155
             $source = $this->loader->load($e->getContext()->getPath());
156
-        } catch (LoaderException) {
156
+        }catch (LoaderException){
157 157
             return $e;
158 158
         }
159 159
 
160
-        if ($source->getFilename() === null) {
160
+        if ($source->getFilename() === null){
161 161
             return $e;
162 162
         }
163 163
 
Please login to merge, or discard this patch.
Braces   +35 added lines, -15 removed lines patch added patch discarded remove patch
@@ -80,14 +80,18 @@  discard block
 block discarded – undo
80 80
      */
81 81
     public function compileTemplate(Template $tpl): Result
82 82
     {
83
-        try {
84
-            if (isset($this->visitors[self::STAGE_COMPILE])) {
83
+        try
84
+        {
85
+            if (isset($this->visitors[self::STAGE_COMPILE]))
86
+            {
85 87
                 $traverser = new Traverser($this->visitors[self::STAGE_COMPILE]);
86 88
                 $tpl = $traverser->traverse([$tpl])[0];
87 89
             }
88 90
 
89 91
             return $this->compiler->compile($tpl);
90
-        } catch (CompilerException $e) {
92
+        }
93
+        catch (CompilerException $e)
94
+        {
91 95
             throw $this->mapException($e);
92 96
         }
93 97
     }
@@ -100,21 +104,29 @@  discard block
 block discarded – undo
100 104
         $source = $this->loader->load($path);
101 105
         $stream = new StringStream($source->getContent());
102 106
 
103
-        try {
107
+        try
108
+        {
104 109
             $tpl = $this->parser->withPath($path)->parse($stream);
105 110
             $tpl->setContext(new Context(
106 111
                 new Token(Token::TYPE_RAW, 0, ''),
107 112
                 $path
108 113
             ));
109
-        } catch (ParserException $e) {
114
+        }
115
+        catch (ParserException $e)
116
+        {
110 117
             throw $this->mapException($e);
111 118
         }
112 119
 
113
-        try {
120
+        try
121
+        {
114 122
             return $this->process($tpl);
115
-        } catch (ContextExceptionInterface $e) {
123
+        }
124
+        catch (ContextExceptionInterface $e)
125
+        {
116 126
             throw $this->mapException($e);
117
-        } catch (\Throwable $e) {
127
+        }
128
+        catch (\Throwable $e)
129
+        {
118 130
             throw $e;
119 131
         }
120 132
     }
@@ -124,17 +136,20 @@  discard block
 block discarded – undo
124 136
      */
125 137
     private function process(Template $template): Template
126 138
     {
127
-        if (isset($this->visitors[self::STAGE_PREPARE])) {
139
+        if (isset($this->visitors[self::STAGE_PREPARE]))
140
+        {
128 141
             $traverser = new Traverser($this->visitors[self::STAGE_PREPARE]);
129 142
             $template = $traverser->traverse([$template])[0];
130 143
         }
131 144
 
132
-        if (isset($this->visitors[self::STAGE_TRANSFORM])) {
145
+        if (isset($this->visitors[self::STAGE_TRANSFORM]))
146
+        {
133 147
             $traverser = new Traverser($this->visitors[self::STAGE_TRANSFORM]);
134 148
             $template = $traverser->traverse([$template])[0];
135 149
         }
136 150
 
137
-        if (isset($this->visitors[self::STAGE_FINALIZE])) {
151
+        if (isset($this->visitors[self::STAGE_FINALIZE]))
152
+        {
138 153
             $traverser = new Traverser($this->visitors[self::STAGE_FINALIZE]);
139 154
             $template = $traverser->traverse([$template])[0];
140 155
         }
@@ -147,17 +162,22 @@  discard block
 block discarded – undo
147 162
      */
148 163
     private function mapException(ContextExceptionInterface $e): ContextExceptionInterface
149 164
     {
150
-        if ($e->getContext()->getPath() === null) {
165
+        if ($e->getContext()->getPath() === null)
166
+        {
151 167
             return $e;
152 168
         }
153 169
 
154
-        try {
170
+        try
171
+        {
155 172
             $source = $this->loader->load($e->getContext()->getPath());
156
-        } catch (LoaderException) {
173
+        }
174
+        catch (LoaderException)
175
+        {
157 176
             return $e;
158 177
         }
159 178
 
160
-        if ($source->getFilename() === null) {
179
+        if ($source->getFilename() === null)
180
+        {
161 181
             return $e;
162 182
         }
163 183
 
Please login to merge, or discard this patch.
src/Stempler/src/Node/Aggregate.php 2 patches
Braces   +18 added lines, -9 removed lines patch added patch discarded remove patch
@@ -35,14 +35,17 @@  discard block
 block discarded – undo
35 35
      */
36 36
     public function accepts(string $name): ?string
37 37
     {
38
-        if ($this->pattern === '' || $this->pattern === '*') {
38
+        if ($this->pattern === '' || $this->pattern === '*')
39
+        {
39 40
             // accept everything
40 41
             return $name;
41 42
         }
42 43
 
43 44
         $conditions = [];
44
-        foreach (\explode(';', $this->pattern) as $condition) {
45
-            if (!\str_contains($condition, ':')) {
45
+        foreach (\explode(';', $this->pattern) as $condition)
46
+        {
47
+            if (!\str_contains($condition, ':'))
48
+            {
46 49
                 //Invalid
47 50
                 continue;
48 51
             }
@@ -51,27 +54,33 @@  discard block
 block discarded – undo
51 54
             $conditions[$option] = $value;
52 55
         }
53 56
 
54
-        if (isset($conditions['include'])) {
57
+        if (isset($conditions['include']))
58
+        {
55 59
             $include = \explode(',', $conditions['include']);
56
-            if (\in_array($name, $include)) {
60
+            if (\in_array($name, $include))
61
+            {
57 62
                 return $name;
58 63
             }
59 64
 
60 65
             return null;
61 66
         }
62 67
 
63
-        if (isset($conditions['exclude'])) {
68
+        if (isset($conditions['exclude']))
69
+        {
64 70
             $exclude = \explode(',', $conditions['exclude']);
65
-            if (\in_array($name, $exclude)) {
71
+            if (\in_array($name, $exclude))
72
+            {
66 73
                 return null;
67 74
             }
68 75
 
69 76
             return $name;
70 77
         }
71 78
 
72
-        if (isset($conditions['prefix'])) {
79
+        if (isset($conditions['prefix']))
80
+        {
73 81
             $conditions['prefix'] = \rtrim($conditions['prefix'], ' *');
74
-            if (\str_starts_with($name, $conditions['prefix'])) {
82
+            if (\str_starts_with($name, $conditions['prefix']))
83
+            {
75 84
                 return substr($name, \strlen($conditions['prefix']));
76 85
             }
77 86
 
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
     public function __construct(
26 26
         ?Context $context = null,
27 27
         public string $pattern = '*'
28
-    ) {
28
+    ){
29 29
         $this->context = $context;
30 30
     }
31 31
 
@@ -35,14 +35,14 @@  discard block
 block discarded – undo
35 35
      */
36 36
     public function accepts(string $name): ?string
37 37
     {
38
-        if ($this->pattern === '' || $this->pattern === '*') {
38
+        if ($this->pattern === '' || $this->pattern === '*'){
39 39
             // accept everything
40 40
             return $name;
41 41
         }
42 42
 
43 43
         $conditions = [];
44
-        foreach (\explode(';', $this->pattern) as $condition) {
45
-            if (!\str_contains($condition, ':')) {
44
+        foreach (\explode(';', $this->pattern) as $condition){
45
+            if (!\str_contains($condition, ':')){
46 46
                 //Invalid
47 47
                 continue;
48 48
             }
@@ -51,27 +51,27 @@  discard block
 block discarded – undo
51 51
             $conditions[$option] = $value;
52 52
         }
53 53
 
54
-        if (isset($conditions['include'])) {
54
+        if (isset($conditions['include'])){
55 55
             $include = \explode(',', $conditions['include']);
56
-            if (\in_array($name, $include)) {
56
+            if (\in_array($name, $include)){
57 57
                 return $name;
58 58
             }
59 59
 
60 60
             return null;
61 61
         }
62 62
 
63
-        if (isset($conditions['exclude'])) {
63
+        if (isset($conditions['exclude'])){
64 64
             $exclude = \explode(',', $conditions['exclude']);
65
-            if (\in_array($name, $exclude)) {
65
+            if (\in_array($name, $exclude)){
66 66
                 return null;
67 67
             }
68 68
 
69 69
             return $name;
70 70
         }
71 71
 
72
-        if (isset($conditions['prefix'])) {
72
+        if (isset($conditions['prefix'])){
73 73
             $conditions['prefix'] = \rtrim($conditions['prefix'], ' *');
74
-            if (\str_starts_with($name, $conditions['prefix'])) {
74
+            if (\str_starts_with($name, $conditions['prefix'])){
75 75
                 return substr($name, \strlen($conditions['prefix']));
76 76
             }
77 77
 
Please login to merge, or discard this patch.
src/Stempler/src/Node/HTML/Tag.php 1 patch
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 bool $void = false;
26 26
 
27
-    public Mixin|string|null $name = null;
27
+    public Mixin | string | null $name = null;
28 28
 
29 29
     /** @var Attr[] */
30 30
     public array $attrs = [];
Please login to merge, or discard this patch.
src/Stempler/src/Exception/SyntaxException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
     public function __construct(
16 16
         string $message,
17 17
         private readonly Token $token
18
-    ) {
18
+    ){
19 19
         $message = \sprintf('%s at offset %s', $message, $token->offset);
20 20
         parent::__construct($message, 0, null);
21 21
     }
Please login to merge, or discard this patch.
src/Stempler/src/Parser/Syntax/Traits/MixinTrait.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@
 block discarded – undo
12 12
 
13 13
 trait MixinTrait
14 14
 {
15
-    private function parseToken(Parser $parser, Token $token): Mixin|Raw|string
15
+    private function parseToken(Parser $parser, Token $token): Mixin | Raw | string
16 16
     {
17
-        if ($token->tokens === []) {
18
-            if ($token->type === Token::TYPE_RAW) {
17
+        if ($token->tokens === []){
18
+            if ($token->type === Token::TYPE_RAW){
19 19
                 return new Raw($token->content);
20 20
             }
21 21
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,8 +14,10 @@
 block discarded – undo
14 14
 {
15 15
     private function parseToken(Parser $parser, Token $token): Mixin|Raw|string
16 16
     {
17
-        if ($token->tokens === []) {
18
-            if ($token->type === Token::TYPE_RAW) {
17
+        if ($token->tokens === [])
18
+        {
19
+            if ($token->type === Token::TYPE_RAW)
20
+            {
19 21
                 return new Raw($token->content);
20 22
             }
21 23
 
Please login to merge, or discard this patch.
src/Stempler/src/Parser/Syntax/InlineSyntax.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
 
20 20
     public function handle(Parser $parser, Assembler $asm, Token $token): void
21 21
     {
22
-        switch ($token->type) {
22
+        switch ($token->type){
23 23
             case InlineGrammar::TYPE_OPEN_TAG:
24 24
                 $this->inline = new Inline(new Parser\Context($token, $parser->getPath()));
25 25
                 $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
@@ -19,7 +19,8 @@
 block discarded – undo
19 19
 
20 20
     public function handle(Parser $parser, Assembler $asm, Token $token): void
21 21
     {
22
-        switch ($token->type) {
22
+        switch ($token->type)
23
+        {
23 24
             case InlineGrammar::TYPE_OPEN_TAG:
24 25
                 $this->inline = new Inline(new Parser\Context($token, $parser->getPath()));
25 26
                 $asm->push($this->inline);
Please login to merge, or discard this patch.
src/Stempler/src/Parser/Syntax/HTMLSyntax.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 
55 55
     public function handle(Parser $parser, Assembler $asm, Token $token): void
56 56
     {
57
-        switch ($token->type) {
57
+        switch ($token->type){
58 58
             case HTMLGrammar::TYPE_OPEN:
59 59
             case HTMLGrammar::TYPE_OPEN_SHORT:
60 60
                 $this->node = new Tag(new Parser\Context($token, $parser->getPath()));
@@ -63,12 +63,12 @@  discard block
 block discarded – undo
63 63
                 break;
64 64
 
65 65
             case HTMLGrammar::TYPE_KEYWORD:
66
-                if ($this->node->name === null) {
66
+                if ($this->node->name === null){
67 67
                     $this->node->name = $this->parseToken($parser, $token);
68 68
                     return;
69 69
                 }
70 70
 
71
-                if ($this->attr !== null && !$this->attr->value instanceof Nil) {
71
+                if ($this->attr !== null && !$this->attr->value instanceof Nil){
72 72
                     $this->attr->value = $this->parseToken($parser, $token);
73 73
                     $this->attr = null;
74 74
                     break;
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
                 break;
85 85
 
86 86
             case HTMLGrammar::TYPE_EQUAL:
87
-                if ($this->attr === null) {
87
+                if ($this->attr === null){
88 88
                     throw new SyntaxException('unexpected attribute token', $token);
89 89
                 }
90 90
 
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
                 break;
94 94
 
95 95
             case HTMLGrammar::TYPE_ATTRIBUTE:
96
-                if ($this->attr === null) {
96
+                if ($this->attr === null){
97 97
                     throw new SyntaxException('unexpected attribute token', $token);
98 98
                 }
99 99
 
@@ -103,9 +103,9 @@  discard block
 block discarded – undo
103 103
                         \str_starts_with($this->attr->name, 'on')
104 104
                         || \in_array($this->attr->name, self::VERBATIM_ATTRIBUTES, true)
105 105
                     )
106
-                ) {
106
+                ){
107 107
                     $this->attr->value = $this->parseVerbatim($parser, $token);
108
-                } else {
108
+                }else{
109 109
                     $this->attr->value = $this->parseToken($parser, $token);
110 110
                 }
111 111
 
@@ -119,8 +119,8 @@  discard block
 block discarded – undo
119 119
                 break;
120 120
 
121 121
             case HTMLGrammar::TYPE_CLOSE:
122
-                if ($this->token->type == HTMLGrammar::TYPE_OPEN_SHORT) {
123
-                    if (!$asm->getNode() instanceof Tag || $asm->getNode()->name !== $this->node->name) {
122
+                if ($this->token->type == HTMLGrammar::TYPE_OPEN_SHORT){
123
+                    if (!$asm->getNode() instanceof Tag || $asm->getNode()->name !== $this->node->name){
124 124
                         /**
125 125
                          * TODO issue #767
126 126
                          * @link https://github.com/spiral/framework/issues/767
@@ -133,10 +133,10 @@  discard block
 block discarded – undo
133 133
                     }
134 134
 
135 135
                     $asm->close();
136
-                } elseif (\in_array($this->node->name, self::VOID_TAGS)) {
136
+                } elseif (\in_array($this->node->name, self::VOID_TAGS)){
137 137
                     $this->node->void = true;
138 138
                     $asm->push($this->node);
139
-                } else {
139
+                }else{
140 140
                     $asm->open($this->node, 'nodes');
141 141
                 }
142 142
                 $this->flush();
@@ -148,9 +148,9 @@  discard block
 block discarded – undo
148 148
                 break;
149 149
 
150 150
             default:
151
-                if ($asm->getNode() instanceof Mixin || $asm->getNode() instanceof Verbatim) {
151
+                if ($asm->getNode() instanceof Mixin || $asm->getNode() instanceof Verbatim){
152 152
                     $node = $this->parseToken($parser, $token);
153
-                    if (\is_string($node)) {
153
+                    if (\is_string($node)){
154 154
                         $node = new Raw($node, new Parser\Context($token, $parser->getPath()));
155 155
                     }
156 156
 
@@ -173,11 +173,11 @@  discard block
 block discarded – undo
173 173
     {
174 174
         $verbatim = new Verbatim(new Parser\Context($token, $parser->getPath()));
175 175
 
176
-        if ($token->tokens === []) {
177
-            if ($token->content) {
176
+        if ($token->tokens === []){
177
+            if ($token->content){
178 178
                 $verbatim->nodes[] = $token->content;
179 179
             }
180
-        } else {
180
+        }else{
181 181
             /**
182 182
              * TODO issue #767
183 183
              * @link https://github.com/spiral/framework/issues/767
Please login to merge, or discard this patch.
Braces   +34 added lines, -15 removed lines patch added patch discarded remove patch
@@ -54,7 +54,8 @@  discard block
 block discarded – undo
54 54
 
55 55
     public function handle(Parser $parser, Assembler $asm, Token $token): void
56 56
     {
57
-        switch ($token->type) {
57
+        switch ($token->type)
58
+        {
58 59
             case HTMLGrammar::TYPE_OPEN:
59 60
             case HTMLGrammar::TYPE_OPEN_SHORT:
60 61
                 $this->node = new Tag(new Parser\Context($token, $parser->getPath()));
@@ -63,12 +64,14 @@  discard block
 block discarded – undo
63 64
                 break;
64 65
 
65 66
             case HTMLGrammar::TYPE_KEYWORD:
66
-                if ($this->node->name === null) {
67
+                if ($this->node->name === null)
68
+                {
67 69
                     $this->node->name = $this->parseToken($parser, $token);
68 70
                     return;
69 71
                 }
70 72
 
71
-                if ($this->attr !== null && !$this->attr->value instanceof Nil) {
73
+                if ($this->attr !== null && !$this->attr->value instanceof Nil)
74
+                {
72 75
                     $this->attr->value = $this->parseToken($parser, $token);
73 76
                     $this->attr = null;
74 77
                     break;
@@ -84,7 +87,8 @@  discard block
 block discarded – undo
84 87
                 break;
85 88
 
86 89
             case HTMLGrammar::TYPE_EQUAL:
87
-                if ($this->attr === null) {
90
+                if ($this->attr === null)
91
+                {
88 92
                     throw new SyntaxException('unexpected attribute token', $token);
89 93
                 }
90 94
 
@@ -93,7 +97,8 @@  discard block
 block discarded – undo
93 97
                 break;
94 98
 
95 99
             case HTMLGrammar::TYPE_ATTRIBUTE:
96
-                if ($this->attr === null) {
100
+                if ($this->attr === null)
101
+                {
97 102
                     throw new SyntaxException('unexpected attribute token', $token);
98 103
                 }
99 104
 
@@ -105,7 +110,9 @@  discard block
 block discarded – undo
105 110
                     )
106 111
                 ) {
107 112
                     $this->attr->value = $this->parseVerbatim($parser, $token);
108
-                } else {
113
+                }
114
+                else
115
+                {
109 116
                     $this->attr->value = $this->parseToken($parser, $token);
110 117
                 }
111 118
 
@@ -119,8 +126,10 @@  discard block
 block discarded – undo
119 126
                 break;
120 127
 
121 128
             case HTMLGrammar::TYPE_CLOSE:
122
-                if ($this->token->type == HTMLGrammar::TYPE_OPEN_SHORT) {
123
-                    if (!$asm->getNode() instanceof Tag || $asm->getNode()->name !== $this->node->name) {
129
+                if ($this->token->type == HTMLGrammar::TYPE_OPEN_SHORT)
130
+                {
131
+                    if (!$asm->getNode() instanceof Tag || $asm->getNode()->name !== $this->node->name)
132
+                    {
124 133
                         /**
125 134
                          * TODO issue #767
126 135
                          * @link https://github.com/spiral/framework/issues/767
@@ -133,10 +142,14 @@  discard block
 block discarded – undo
133 142
                     }
134 143
 
135 144
                     $asm->close();
136
-                } elseif (\in_array($this->node->name, self::VOID_TAGS)) {
145
+                }
146
+                elseif (\in_array($this->node->name, self::VOID_TAGS))
147
+                {
137 148
                     $this->node->void = true;
138 149
                     $asm->push($this->node);
139
-                } else {
150
+                }
151
+                else
152
+                {
140 153
                     $asm->open($this->node, 'nodes');
141 154
                 }
142 155
                 $this->flush();
@@ -148,9 +161,11 @@  discard block
 block discarded – undo
148 161
                 break;
149 162
 
150 163
             default:
151
-                if ($asm->getNode() instanceof Mixin || $asm->getNode() instanceof Verbatim) {
164
+                if ($asm->getNode() instanceof Mixin || $asm->getNode() instanceof Verbatim)
165
+                {
152 166
                     $node = $this->parseToken($parser, $token);
153
-                    if (\is_string($node)) {
167
+                    if (\is_string($node))
168
+                    {
154 169
                         $node = new Raw($node, new Parser\Context($token, $parser->getPath()));
155 170
                     }
156 171
 
@@ -173,11 +188,15 @@  discard block
 block discarded – undo
173 188
     {
174 189
         $verbatim = new Verbatim(new Parser\Context($token, $parser->getPath()));
175 190
 
176
-        if ($token->tokens === []) {
177
-            if ($token->content) {
191
+        if ($token->tokens === [])
192
+        {
193
+            if ($token->content)
194
+            {
178 195
                 $verbatim->nodes[] = $token->content;
179 196
             }
180
-        } else {
197
+        }
198
+        else
199
+        {
181 200
             /**
182 201
              * TODO issue #767
183 202
              * @link https://github.com/spiral/framework/issues/767
Please login to merge, or discard this patch.
src/Stempler/src/Parser/Context.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
     public function __construct(
18 18
         private Token $token,
19 19
         private ?string $path = null
20
-    ) {
20
+    ){
21 21
     }
22 22
 
23 23
     public function getToken(): Token
Please login to merge, or discard this patch.
src/Stempler/src/Parser/Assembler.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
     public function __construct(
23 23
         private NodeInterface $node,
24 24
         private string $path
25
-    ) {
25
+    ){
26 26
     }
27 27
 
28 28
     public function getNode(): NodeInterface
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     public function getStackPath(): string
34 34
     {
35 35
         $path = [$this->nodeName($this->node)];
36
-        foreach ($this->stack as $tuple) {
36
+        foreach ($this->stack as $tuple){
37 37
             $path[] = $this->nodeName($tuple[0]);
38 38
         }
39 39
 
@@ -74,13 +74,13 @@  discard block
 block discarded – undo
74 74
     private function nodeName(NodeInterface $node): string
75 75
     {
76 76
         $r = new \ReflectionClass($node);
77
-        if (\property_exists($node, 'name')) {
77
+        if (\property_exists($node, 'name')){
78 78
             /**
79 79
              * TODO issue #767
80 80
              * @link https://github.com/spiral/framework/issues/767
81 81
              * @psalm-suppress NoInterfaceProperties
82 82
              */
83
-            return \lcfirst($r->getShortName()) . \sprintf('[%s]', $node->name);
83
+            return \lcfirst($r->getShortName()).\sprintf('[%s]', $node->name);
84 84
         }
85 85
 
86 86
         return \lcfirst($r->getShortName());
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,8 @@  discard block
 block discarded – undo
33 33
     public function getStackPath(): string
34 34
     {
35 35
         $path = [$this->nodeName($this->node)];
36
-        foreach ($this->stack as $tuple) {
36
+        foreach ($this->stack as $tuple)
37
+        {
37 38
             $path[] = $this->nodeName($tuple[0]);
38 39
         }
39 40
 
@@ -74,7 +75,8 @@  discard block
 block discarded – undo
74 75
     private function nodeName(NodeInterface $node): string
75 76
     {
76 77
         $r = new \ReflectionClass($node);
77
-        if (\property_exists($node, 'name')) {
78
+        if (\property_exists($node, 'name'))
79
+        {
78 80
             /**
79 81
              * TODO issue #767
80 82
              * @link https://github.com/spiral/framework/issues/767
Please login to merge, or discard this patch.