Passed
Pull Request — master (#1144)
by Abdul Malik
19:49 queued 07:21
created
src/Stempler/src/Parser/Syntax/DynamicSyntax.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
     public function handle(Parser $parser, Assembler $asm, Token $token): void
26 26
     {
27
-        switch ($token->type) {
27
+        switch ($token->type){
28 28
             case DynamicGrammar::TYPE_DIRECTIVE:
29 29
                 $this->directive = new Directive(new Context($token, $parser->getPath()));
30 30
                 $asm->push($this->directive);
@@ -49,20 +49,20 @@  discard block
 block discarded – undo
49 49
                 break;
50 50
 
51 51
             case DynamicGrammar::TYPE_KEYWORD:
52
-                if ($this->directive !== null) {
52
+                if ($this->directive !== null){
53 53
                     $this->directive->name = $token->content;
54 54
                 }
55 55
                 break;
56 56
 
57 57
             case DynamicGrammar::TYPE_BODY:
58
-                if ($this->directive !== null) {
58
+                if ($this->directive !== null){
59 59
                     $this->directive->body = $token->content;
60 60
                     $this->directive->values = $this->fetchValues($this->directive->body);
61 61
 
62 62
                     $this->directive = null;
63 63
                 }
64 64
 
65
-                if ($this->output !== null) {
65
+                if ($this->output !== null){
66 66
                     $this->output->body = $token->content;
67 67
                 }
68 68
 
@@ -80,31 +80,31 @@  discard block
 block discarded – undo
80 80
 
81 81
         $src = new StringStream($body);
82 82
 
83
-        while ($n = $src->peak()) {
84
-            if (\in_array($n, ['"', "'"], true)) {
83
+        while ($n = $src->peak()){
84
+            if (\in_array($n, ['"', "'"], true)){
85 85
                 $values[\count($values) - 1] .= $n;
86
-                while (($nn = $src->peak()) !== null) {
86
+                while (($nn = $src->peak()) !== null){
87 87
                     $values[\count($values) - 1] .= $nn;
88
-                    if ($nn === $n) {
88
+                    if ($nn === $n){
89 89
                         break;
90 90
                     }
91 91
                 }
92 92
                 continue;
93 93
             }
94 94
 
95
-            if ($n === ',' && $level === 0) {
95
+            if ($n === ',' && $level === 0){
96 96
                 $values[] = '';
97 97
                 continue;
98 98
             }
99 99
 
100 100
             $values[\count($values) - 1] .= $n;
101 101
 
102
-            if ($n === '(' || $n === '[' || $n === '{') {
102
+            if ($n === '(' || $n === '[' || $n === '{'){
103 103
                 $level++;
104 104
                 continue;
105 105
             }
106 106
 
107
-            if ($n === ')' || $n === ']' || $n === '}') {
107
+            if ($n === ')' || $n === ']' || $n === '}'){
108 108
                 $level--;
109 109
             }
110 110
         }
Please login to merge, or discard this patch.
src/Stempler/src/Parser/Syntax/HTMLSyntax.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 
57 57
     public function handle(Parser $parser, Assembler $asm, Token $token): void
58 58
     {
59
-        switch ($token->type) {
59
+        switch ($token->type){
60 60
             case HTMLGrammar::TYPE_OPEN:
61 61
             case HTMLGrammar::TYPE_OPEN_SHORT:
62 62
                 $this->node = new Tag(new Context($token, $parser->getPath()));
@@ -65,12 +65,12 @@  discard block
 block discarded – undo
65 65
                 break;
66 66
 
67 67
             case HTMLGrammar::TYPE_KEYWORD:
68
-                if ($this->node->name === null) {
68
+                if ($this->node->name === null){
69 69
                     $this->node->name = $this->parseToken($parser, $token);
70 70
                     return;
71 71
                 }
72 72
 
73
-                if ($this->attr !== null && !$this->attr->value instanceof Nil) {
73
+                if ($this->attr !== null && !$this->attr->value instanceof Nil){
74 74
                     $this->attr->value = $this->parseToken($parser, $token);
75 75
                     $this->attr = null;
76 76
                     break;
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
                 break;
87 87
 
88 88
             case HTMLGrammar::TYPE_EQUAL:
89
-                if ($this->attr === null) {
89
+                if ($this->attr === null){
90 90
                     throw new SyntaxException('unexpected attribute token', $token);
91 91
                 }
92 92
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
                 break;
96 96
 
97 97
             case HTMLGrammar::TYPE_ATTRIBUTE:
98
-                if ($this->attr === null) {
98
+                if ($this->attr === null){
99 99
                     throw new SyntaxException('unexpected attribute token', $token);
100 100
                 }
101 101
 
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
                         \str_starts_with($this->attr->name, 'on')
106 106
                         || \in_array($this->attr->name, self::VERBATIM_ATTRIBUTES, true)
107 107
                     )
108
-                ) {
108
+                ){
109 109
                     $this->attr->value = $this->parseVerbatim($parser, $token);
110
-                } else {
110
+                }else{
111 111
                     $this->attr->value = $this->parseToken($parser, $token);
112 112
                 }
113 113
 
@@ -121,8 +121,8 @@  discard block
 block discarded – undo
121 121
                 break;
122 122
 
123 123
             case HTMLGrammar::TYPE_CLOSE:
124
-                if ($this->token->type == HTMLGrammar::TYPE_OPEN_SHORT) {
125
-                    if (!$asm->getNode() instanceof Tag || $asm->getNode()->name !== $this->node->name) {
124
+                if ($this->token->type == HTMLGrammar::TYPE_OPEN_SHORT){
125
+                    if (!$asm->getNode() instanceof Tag || $asm->getNode()->name !== $this->node->name){
126 126
                         /**
127 127
                          * TODO issue #767
128 128
                          * @link https://github.com/spiral/framework/issues/767
@@ -135,10 +135,10 @@  discard block
 block discarded – undo
135 135
                     }
136 136
 
137 137
                     $asm->close();
138
-                } elseif (\in_array($this->node->name, self::VOID_TAGS)) {
138
+                } elseif (\in_array($this->node->name, self::VOID_TAGS)){
139 139
                     $this->node->void = true;
140 140
                     $asm->push($this->node);
141
-                } else {
141
+                }else{
142 142
                     $asm->open($this->node, 'nodes');
143 143
                 }
144 144
                 $this->flush();
@@ -150,9 +150,9 @@  discard block
 block discarded – undo
150 150
                 break;
151 151
 
152 152
             default:
153
-                if ($asm->getNode() instanceof Mixin || $asm->getNode() instanceof Verbatim) {
153
+                if ($asm->getNode() instanceof Mixin || $asm->getNode() instanceof Verbatim){
154 154
                     $node = $this->parseToken($parser, $token);
155
-                    if (\is_string($node)) {
155
+                    if (\is_string($node)){
156 156
                         $node = new Raw($node, new Context($token, $parser->getPath()));
157 157
                     }
158 158
 
@@ -175,11 +175,11 @@  discard block
 block discarded – undo
175 175
     {
176 176
         $verbatim = new Verbatim(new Context($token, $parser->getPath()));
177 177
 
178
-        if ($token->tokens === []) {
179
-            if ($token->content) {
178
+        if ($token->tokens === []){
179
+            if ($token->content){
180 180
                 $verbatim->nodes[] = $token->content;
181 181
             }
182
-        } else {
182
+        }else{
183 183
             /**
184 184
              * TODO issue #767
185 185
              * @link https://github.com/spiral/framework/issues/767
Please login to merge, or discard this patch.
src/Stempler/src/Parser/Syntax/InlineSyntax.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
 
22 22
     public function handle(Parser $parser, Assembler $asm, Token $token): void
23 23
     {
24
-        switch ($token->type) {
24
+        switch ($token->type){
25 25
             case InlineGrammar::TYPE_OPEN_TAG:
26 26
                 $this->inline = new Inline(new Context($token, $parser->getPath()));
27 27
                 $asm->push($this->inline);
Please login to merge, or discard this patch.
src/Stempler/src/Compiler/Renderer/PHPRenderer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 {
15 15
     public function render(Compiler $compiler, Result $result, NodeInterface $node): bool
16 16
     {
17
-        if ($node instanceof PHP) {
17
+        if ($node instanceof PHP){
18 18
             $result->push($node->content, $node->getContext());
19 19
             return true;
20 20
         }
Please login to merge, or discard this patch.
src/Stempler/src/Compiler/Renderer/HTMLRenderer.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 {
18 18
     public function render(Compiler $compiler, Result $result, NodeInterface $node): bool
19 19
     {
20
-        switch (true) {
20
+        switch (true){
21 21
             case $node instanceof Tag:
22 22
                 $this->tag($compiler, $result, $node);
23 23
                 return true;
@@ -36,8 +36,8 @@  discard block
 block discarded – undo
36 36
     {
37 37
         $result->push(\sprintf('<%s', $node->name), $node->getContext());
38 38
 
39
-        foreach ($node->attrs as $attr) {
40
-            if (!$attr instanceof Attr) {
39
+        foreach ($node->attrs as $attr){
40
+            if (!$attr instanceof Attr){
41 41
                 $compiler->compile($attr, $result);
42 42
                 continue;
43 43
             }
@@ -47,30 +47,30 @@  discard block
 block discarded – undo
47 47
 
48 48
         $result->push(\sprintf('%s>', $node->void ? '/' : ''), null);
49 49
 
50
-        foreach ($node->nodes as $child) {
50
+        foreach ($node->nodes as $child){
51 51
             $compiler->compile($child, $result);
52 52
         }
53 53
 
54
-        if (!$node->void) {
54
+        if (!$node->void){
55 55
             $result->push(\sprintf('</%s>', $node->name), null);
56 56
         }
57 57
     }
58 58
 
59 59
     private function attribute(Compiler $compiler, Result $result, Attr $node): void
60 60
     {
61
-        if ($node->name instanceof NodeInterface) {
61
+        if ($node->name instanceof NodeInterface){
62 62
             $result->push(' ', null);
63 63
             $compiler->compile($node->name, $result);
64
-        } else {
64
+        }else{
65 65
             $result->push(\sprintf(' %s', $node->name), $node->getContext());
66 66
         }
67 67
 
68 68
         $value = $node->value;
69
-        if ($value instanceof Nil) {
69
+        if ($value instanceof Nil){
70 70
             return;
71 71
         }
72 72
 
73
-        if ($value instanceof NodeInterface) {
73
+        if ($value instanceof NodeInterface){
74 74
             $result->push('=', null);
75 75
             $compiler->compile($value, $result);
76 76
             return;
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
 
82 82
     private function verbatim(Compiler $compiler, Result $result, Verbatim $node): void
83 83
     {
84
-        foreach ($node->nodes as $child) {
85
-            if (\is_string($child)) {
84
+        foreach ($node->nodes as $child){
85
+            if (\is_string($child)){
86 86
                 $result->push($child, null);
87 87
                 continue;
88 88
             }
Please login to merge, or discard this patch.
src/Stempler/src/Compiler/Renderer/CoreRenderer.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
         Result $result,
23 23
         NodeInterface $node
24 24
     ): bool {
25
-        switch (true) {
25
+        switch (true){
26 26
             case $node instanceof Hidden:
27 27
                 return true;
28 28
 
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
                 $result->withinContext(
31 31
                     $node->getContext(),
32 32
                     function (Result $source) use ($node, $compiler): void {
33
-                        foreach ($node->nodes as $child) {
33
+                        foreach ($node->nodes as $child){
34 34
                             $compiler->compile($child, $source);
35 35
                         }
36 36
                     }
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
                 $result->withinContext(
43 43
                     $node->getContext(),
44 44
                     function (Result $source) use ($node, $compiler): void {
45
-                        foreach ($node->nodes as $child) {
46
-                            if (\is_string($child)) {
45
+                        foreach ($node->nodes as $child){
46
+                            if (\is_string($child)){
47 47
                                 $source->push($child, null);
48 48
                                 continue;
49 49
                             }
Please login to merge, or discard this patch.
src/Stempler/src/Compiler/Renderer/DynamicRenderer.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -21,12 +21,12 @@  discard block
 block discarded – undo
21 21
     public function __construct(
22 22
         private readonly ?DirectiveRendererInterface $directiveRenderer = null,
23 23
         private readonly string $defaultFilter = self::DEFAULT_FILTER
24
-    ) {
24
+    ){
25 25
     }
26 26
 
27 27
     public function render(Compiler $compiler, Result $result, NodeInterface $node): bool
28 28
     {
29
-        switch (true) {
29
+        switch (true){
30 30
             case $node instanceof Output:
31 31
                 $this->output($result, $node);
32 32
                 return true;
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
      */
44 44
     private function directive(Result $source, Directive $directive): void
45 45
     {
46
-        if ($this->directiveRenderer !== null) {
46
+        if ($this->directiveRenderer !== null){
47 47
             $result = $this->directiveRenderer->render($directive);
48
-            if ($result !== null) {
48
+            if ($result !== null){
49 49
                 $source->push($result, $directive->getContext());
50 50
                 return;
51 51
             }
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 
60 60
     private function output(Result $source, Output $output): void
61 61
     {
62
-        if ($output->rawOutput) {
62
+        if ($output->rawOutput){
63 63
             $source->push(\sprintf('<?php echo %s; ?>', \trim($output->body)), $output->getContext());
64 64
             return;
65 65
         }
Please login to merge, or discard this patch.
src/Serializer/src/Bootloader/SerializerBootloader.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
         private readonly ConfiguratorInterface $config,
35 35
         private readonly ContainerInterface $container,
36 36
         private readonly FactoryInterface $factory
37
-    ) {
37
+    ){
38 38
     }
39 39
 
40 40
     public function init(EnvironmentInterface $env): void
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
             'json' => new JsonSerializer(),
61 61
             'serializer' => new PhpSerializer(),
62 62
         ];
63
-        if (\class_exists(Message::class)) {
63
+        if (\class_exists(Message::class)){
64 64
             $serializers['proto'] = new ProtoSerializer();
65 65
         }
66 66
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
      * @throws ContainerExceptionInterface
75 75
      * @throws NotFoundExceptionInterface
76 76
      */
77
-    private function wire(string|Autowire|SerializerInterface $serializer): SerializerInterface
77
+    private function wire(string | Autowire | SerializerInterface $serializer): SerializerInterface
78 78
     {
79 79
         return match (true) {
80 80
             $serializer instanceof SerializerInterface => $serializer,
Please login to merge, or discard this patch.
src/Events/src/Bootloader/EventsBootloader.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 
49 49
     public function __construct(
50 50
         private readonly ConfiguratorInterface $configs
51
-    ) {
51
+    ){
52 52
     }
53 53
 
54 54
     public function init(): void
@@ -72,11 +72,11 @@  discard block
 block discarded – undo
72 72
         FinalizerInterface $finalizer,
73 73
         ?EventDispatcherInterface $eventDispatcher = null
74 74
     ): void {
75
-        if ($eventDispatcher !== null) {
75
+        if ($eventDispatcher !== null){
76 76
             $this->initEventDispatcher(new Core($eventDispatcher), $config, $container, $factory);
77 77
         }
78 78
 
79
-        foreach ($config->getProcessors() as $processor) {
79
+        foreach ($config->getProcessors() as $processor){
80 80
             $processor = $this->autowire($processor, $container, $factory);
81 81
 
82 82
             \assert($processor instanceof ProcessorInterface);
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
             $registry->process();
88 88
         });
89 89
 
90
-        if ($finalizer instanceof EventDispatcherAwareInterface && $eventDispatcher !== null) {
90
+        if ($finalizer instanceof EventDispatcherAwareInterface && $eventDispatcher !== null){
91 91
             $finalizer->setEventDispatcher($eventDispatcher);
92 92
         }
93 93
     }
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
      * @param TInterceptor $interceptor
97 97
      */
98 98
     public function addInterceptor(
99
-        string|InterceptorInterface|CoreInterceptorInterface|Autowire $interceptor,
99
+        string | InterceptorInterface | CoreInterceptorInterface | Autowire $interceptor,
100 100
     ): void {
101 101
         $this->configs->modify(EventsConfig::CONFIG, new Append('interceptors', null, $interceptor));
102 102
     }
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
     ): void {
110 110
         $builder = new CompatiblePipelineBuilder();
111 111
         $list = [];
112
-        foreach ($config->getInterceptors() as $interceptor) {
112
+        foreach ($config->getInterceptors() as $interceptor){
113 113
             $list[] = $this->autowire($interceptor, $container, $factory);
114 114
         }
115 115
 
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
      *
128 128
      * @throws ContainerExceptionInterface
129 129
      */
130
-    private function autowire(string|object $id, ContainerInterface $container, FactoryInterface $factory): object
130
+    private function autowire(string | object $id, ContainerInterface $container, FactoryInterface $factory): object
131 131
     {
132 132
         return match (true) {
133 133
             \is_string($id) => $container->get($id),
Please login to merge, or discard this patch.