@@ -108,7 +108,7 @@ |
||
108 | 108 | public function createHandler(array $definitions = []): AutowireHandler |
109 | 109 | { |
110 | 110 | $container = new Container(); |
111 | - foreach ($definitions as $id => $definition) { |
|
111 | + foreach ($definitions as $id => $definition){ |
|
112 | 112 | $container->bind($id, $definition); |
113 | 113 | } |
114 | 114 |
@@ -108,7 +108,8 @@ |
||
108 | 108 | public function createHandler(array $definitions = []): AutowireHandler |
109 | 109 | { |
110 | 110 | $container = new Container(); |
111 | - foreach ($definitions as $id => $definition) { |
|
111 | + foreach ($definitions as $id => $definition) |
|
112 | + { |
|
112 | 113 | $container->bind($id, $definition); |
113 | 114 | } |
114 | 115 |
@@ -28,15 +28,18 @@ discard block |
||
28 | 28 | 'namespaces' => $config->getNamespaces(), |
29 | 29 | ]); |
30 | 30 | |
31 | - foreach ($this->config->getDependencies() as $dependency) { |
|
31 | + foreach ($this->config->getDependencies() as $dependency) |
|
32 | + { |
|
32 | 33 | $this->addDependency($dependency->resolve($factory)); |
33 | 34 | } |
34 | 35 | |
35 | - foreach ($this->config->getEngines() as $engine) { |
|
36 | + foreach ($this->config->getEngines() as $engine) |
|
37 | + { |
|
36 | 38 | $this->addEngine($engine->resolve($factory)); |
37 | 39 | } |
38 | 40 | |
39 | - if ($this->config->isCacheEnabled()) { |
|
41 | + if ($this->config->isCacheEnabled()) |
|
42 | + { |
|
40 | 43 | $this->cache = new ViewCache(); |
41 | 44 | } |
42 | 45 | } |
@@ -93,7 +96,8 @@ discard block |
||
93 | 96 | |
94 | 97 | // Rotate all possible context variants and warm up cache |
95 | 98 | $generator = new ContextGenerator($this->context); |
96 | - foreach ($generator->generate() as $context) { |
|
99 | + foreach ($generator->generate() as $context) |
|
100 | + { |
|
97 | 101 | $engine->reset($path, $context); |
98 | 102 | $engine->compile($path, $context); |
99 | 103 | } |
@@ -110,7 +114,8 @@ discard block |
||
110 | 114 | |
111 | 115 | // Rotate all possible context variants and warm up cache |
112 | 116 | $generator = new ContextGenerator($this->context); |
113 | - foreach ($generator->generate() as $context) { |
|
117 | + foreach ($generator->generate() as $context) |
|
118 | + { |
|
114 | 119 | $engine->reset($path, $context); |
115 | 120 | } |
116 | 121 | } |
@@ -122,7 +127,8 @@ discard block |
||
122 | 127 | */ |
123 | 128 | public function get(string $path): ViewInterface |
124 | 129 | { |
125 | - if ($this->cache?->has($this->context, $path)) { |
|
130 | + if ($this->cache?->has($this->context, $path)) |
|
131 | + { |
|
126 | 132 | return $this->cache->get($this->context, $path); |
127 | 133 | } |
128 | 134 | |
@@ -150,8 +156,10 @@ discard block |
||
150 | 156 | */ |
151 | 157 | private function findEngine(string $path): EngineInterface |
152 | 158 | { |
153 | - foreach ($this->engines as $engine) { |
|
154 | - if ($engine->getLoader()->exists($path)) { |
|
159 | + foreach ($this->engines as $engine) |
|
160 | + { |
|
161 | + if ($engine->getLoader()->exists($path)) |
|
162 | + { |
|
155 | 163 | return $engine; |
156 | 164 | } |
157 | 165 | } |
@@ -22,21 +22,21 @@ discard block |
||
22 | 22 | private readonly GlobalVariablesInterface $globalVariables, |
23 | 23 | FactoryInterface $factory, |
24 | 24 | ?ContextInterface $context = null, |
25 | - ) { |
|
25 | + ){ |
|
26 | 26 | $this->context = $context ?? new ViewContext(); |
27 | 27 | $this->loader = $factory->make(LoaderInterface::class, [ |
28 | 28 | 'namespaces' => $config->getNamespaces(), |
29 | 29 | ]); |
30 | 30 | |
31 | - foreach ($this->config->getDependencies() as $dependency) { |
|
31 | + foreach ($this->config->getDependencies() as $dependency){ |
|
32 | 32 | $this->addDependency($dependency->resolve($factory)); |
33 | 33 | } |
34 | 34 | |
35 | - foreach ($this->config->getEngines() as $engine) { |
|
35 | + foreach ($this->config->getEngines() as $engine){ |
|
36 | 36 | $this->addEngine($engine->resolve($factory)); |
37 | 37 | } |
38 | 38 | |
39 | - if ($this->config->isCacheEnabled()) { |
|
39 | + if ($this->config->isCacheEnabled()){ |
|
40 | 40 | $this->cache = new ViewCache(); |
41 | 41 | } |
42 | 42 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | |
93 | 93 | // Rotate all possible context variants and warm up cache |
94 | 94 | $generator = new ContextGenerator($this->context); |
95 | - foreach ($generator->generate() as $context) { |
|
95 | + foreach ($generator->generate() as $context){ |
|
96 | 96 | $engine->reset($path, $context); |
97 | 97 | $engine->compile($path, $context); |
98 | 98 | } |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | |
110 | 110 | // Rotate all possible context variants and warm up cache |
111 | 111 | $generator = new ContextGenerator($this->context); |
112 | - foreach ($generator->generate() as $context) { |
|
112 | + foreach ($generator->generate() as $context){ |
|
113 | 113 | $engine->reset($path, $context); |
114 | 114 | } |
115 | 115 | } |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public function get(string $path): ViewInterface |
123 | 123 | { |
124 | - if ($this->cache?->has($this->context, $path)) { |
|
124 | + if ($this->cache?->has($this->context, $path)){ |
|
125 | 125 | return $this->cache->get($this->context, $path); |
126 | 126 | } |
127 | 127 | |
@@ -148,8 +148,8 @@ discard block |
||
148 | 148 | */ |
149 | 149 | private function findEngine(string $path): EngineInterface |
150 | 150 | { |
151 | - foreach ($this->engines as $engine) { |
|
152 | - if ($engine->getLoader()->exists($path)) { |
|
151 | + foreach ($this->engines as $engine){ |
|
152 | + if ($engine->getLoader()->exists($path)){ |
|
153 | 153 | return $engine; |
154 | 154 | } |
155 | 155 | } |
@@ -29,7 +29,7 @@ |
||
29 | 29 | ResponseFactoryInterface $responseFactory, |
30 | 30 | BroadcastConfig $config, |
31 | 31 | ?EventDispatcherInterface $dispatcher = null, |
32 | - ): AuthorizationMiddleware => new AuthorizationMiddleware( |
|
32 | + ) : AuthorizationMiddleware => new AuthorizationMiddleware( |
|
33 | 33 | $broadcast, |
34 | 34 | $responseFactory, |
35 | 35 | $config->getAuthorizationPath(), |
@@ -55,17 +55,21 @@ discard block |
||
55 | 55 | |
56 | 56 | public function leaveNode(mixed $node, VisitorContext $ctx): mixed |
57 | 57 | { |
58 | - if ($node instanceof Output) { |
|
58 | + if ($node instanceof Output) |
|
59 | + { |
|
59 | 60 | return $this->output($node, $ctx); |
60 | 61 | } |
61 | 62 | |
62 | - if ($node instanceof Directive) { |
|
63 | + if ($node instanceof Directive) |
|
64 | + { |
|
63 | 65 | return $this->directive($node); |
64 | 66 | } |
65 | 67 | |
66 | - if ($node instanceof Template) { |
|
68 | + if ($node instanceof Template) |
|
69 | + { |
|
67 | 70 | $extendsTag = $node->getAttribute(ExtendsParent::class); |
68 | - if ($extendsTag instanceof Tag) { |
|
71 | + if ($extendsTag instanceof Tag) |
|
72 | + { |
|
69 | 73 | $extendsTag->attrs = $this->traverser->traverse($extendsTag->attrs); |
70 | 74 | } |
71 | 75 | } |
@@ -75,9 +79,11 @@ discard block |
||
75 | 79 | |
76 | 80 | private function directive(Directive $node): PHP |
77 | 81 | { |
78 | - foreach ($this->directives as $renderer) { |
|
82 | + foreach ($this->directives as $renderer) |
|
83 | + { |
|
79 | 84 | $result = $renderer->render($node); |
80 | - if ($result !== null) { |
|
85 | + if ($result !== null) |
|
86 | + { |
|
81 | 87 | return new PHP($result, \token_get_all($result), $node->getContext()); |
82 | 88 | } |
83 | 89 | } |
@@ -94,9 +100,12 @@ discard block |
||
94 | 100 | * In future this method can support context aware escaping based on tag location. |
95 | 101 | */ |
96 | 102 | |
97 | - if ($node->rawOutput) { |
|
103 | + if ($node->rawOutput) |
|
104 | + { |
|
98 | 105 | $result = \sprintf('<?php echo %s; ?>', \trim((string) $node->body)); |
99 | - } else { |
|
106 | + } |
|
107 | + else |
|
108 | + { |
|
100 | 109 | $filter = $node->filter ?? $this->getFilterContext($ctx); |
101 | 110 | |
102 | 111 | $result = \sprintf(\sprintf('<?php echo %s; ?>', $filter), \trim((string) $node->body)); |
@@ -114,22 +123,27 @@ discard block |
||
114 | 123 | // only "interesting" nodes |
115 | 124 | $context = []; |
116 | 125 | |
117 | - foreach (\array_reverse($ctx->getScope()) as $node) { |
|
118 | - if ($node instanceof Attr || $node instanceof Tag || $node instanceof Verbatim) { |
|
126 | + foreach (\array_reverse($ctx->getScope()) as $node) |
|
127 | + { |
|
128 | + if ($node instanceof Attr || $node instanceof Tag || $node instanceof Verbatim) |
|
129 | + { |
|
119 | 130 | $context[] = $node; |
120 | 131 | } |
121 | 132 | |
122 | - if (\count($context) === 2) { |
|
133 | + if (\count($context) === 2) |
|
134 | + { |
|
123 | 135 | break; |
124 | 136 | } |
125 | 137 | } |
126 | 138 | |
127 | - if (\count($context) !== 2) { |
|
139 | + if (\count($context) !== 2) |
|
140 | + { |
|
128 | 141 | return $this->defaultFilter; |
129 | 142 | } |
130 | 143 | |
131 | 144 | // php {{ }} in javascript code (variable passing), use {! !} to bypass the filter |
132 | - if ($context[0] instanceof Verbatim && $context[1] instanceof Tag && $context[1]->name === 'script') { |
|
145 | + if ($context[0] instanceof Verbatim && $context[1] instanceof Tag && $context[1]->name === 'script') |
|
146 | + { |
|
133 | 147 | return \sprintf( |
134 | 148 | 'json_encode(%s, %s, %s)', |
135 | 149 | '%s', |
@@ -139,7 +153,8 @@ discard block |
||
139 | 153 | } |
140 | 154 | |
141 | 155 | // in on* and other attributes |
142 | - if ($context[0] instanceof Verbatim && $context[1] instanceof Attr && $context[1]->name !== 'style') { |
|
156 | + if ($context[0] instanceof Verbatim && $context[1] instanceof Attr && $context[1]->name !== 'style') |
|
157 | + { |
|
143 | 158 | return \sprintf("'%s', %s, '%s'", '"', $this->defaultFilter, '"'); |
144 | 159 | } |
145 | 160 |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | public function __construct( |
36 | 36 | private readonly string $defaultFilter = self::DEFAULT_FILTER, |
37 | 37 | private array $directives = [], |
38 | - ) { |
|
38 | + ){ |
|
39 | 39 | $this->traverser = new Traverser(); |
40 | 40 | $this->traverser->addVisitor($this); |
41 | 41 | } |
@@ -55,17 +55,17 @@ discard block |
||
55 | 55 | |
56 | 56 | public function leaveNode(mixed $node, VisitorContext $ctx): mixed |
57 | 57 | { |
58 | - if ($node instanceof Output) { |
|
58 | + if ($node instanceof Output){ |
|
59 | 59 | return $this->output($node, $ctx); |
60 | 60 | } |
61 | 61 | |
62 | - if ($node instanceof Directive) { |
|
62 | + if ($node instanceof Directive){ |
|
63 | 63 | return $this->directive($node); |
64 | 64 | } |
65 | 65 | |
66 | - if ($node instanceof Template) { |
|
66 | + if ($node instanceof Template){ |
|
67 | 67 | $extendsTag = $node->getAttribute(ExtendsParent::class); |
68 | - if ($extendsTag instanceof Tag) { |
|
68 | + if ($extendsTag instanceof Tag){ |
|
69 | 69 | $extendsTag->attrs = $this->traverser->traverse($extendsTag->attrs); |
70 | 70 | } |
71 | 71 | } |
@@ -75,9 +75,9 @@ discard block |
||
75 | 75 | |
76 | 76 | private function directive(Directive $node): PHP |
77 | 77 | { |
78 | - foreach ($this->directives as $renderer) { |
|
78 | + foreach ($this->directives as $renderer){ |
|
79 | 79 | $result = $renderer->render($node); |
80 | - if ($result !== null) { |
|
80 | + if ($result !== null){ |
|
81 | 81 | return new PHP($result, \token_get_all($result), $node->getContext()); |
82 | 82 | } |
83 | 83 | } |
@@ -94,18 +94,18 @@ discard block |
||
94 | 94 | * In future this method can support context aware escaping based on tag location. |
95 | 95 | */ |
96 | 96 | |
97 | - if ($node->rawOutput) { |
|
98 | - $result = \sprintf('<?php echo %s; ?>', \trim((string) $node->body)); |
|
99 | - } else { |
|
97 | + if ($node->rawOutput){ |
|
98 | + $result = \sprintf('<?php echo %s; ?>', \trim((string)$node->body)); |
|
99 | + }else{ |
|
100 | 100 | $filter = $node->filter ?? $this->getFilterContext($ctx); |
101 | 101 | |
102 | - $result = \sprintf(\sprintf('<?php echo %s; ?>', $filter), \trim((string) $node->body)); |
|
102 | + $result = \sprintf(\sprintf('<?php echo %s; ?>', $filter), \trim((string)$node->body)); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | return new PHP( |
106 | 106 | $result, |
107 | 107 | \token_get_all($result), |
108 | - $node->getContext()->withValue(PHP::ORIGINAL_BODY, \trim((string) $node->body)), |
|
108 | + $node->getContext()->withValue(PHP::ORIGINAL_BODY, \trim((string)$node->body)), |
|
109 | 109 | ); |
110 | 110 | } |
111 | 111 | |
@@ -114,22 +114,22 @@ discard block |
||
114 | 114 | // only "interesting" nodes |
115 | 115 | $context = []; |
116 | 116 | |
117 | - foreach (\array_reverse($ctx->getScope()) as $node) { |
|
118 | - if ($node instanceof Attr || $node instanceof Tag || $node instanceof Verbatim) { |
|
117 | + foreach (\array_reverse($ctx->getScope()) as $node){ |
|
118 | + if ($node instanceof Attr || $node instanceof Tag || $node instanceof Verbatim){ |
|
119 | 119 | $context[] = $node; |
120 | 120 | } |
121 | 121 | |
122 | - if (\count($context) === 2) { |
|
122 | + if (\count($context) === 2){ |
|
123 | 123 | break; |
124 | 124 | } |
125 | 125 | } |
126 | 126 | |
127 | - if (\count($context) !== 2) { |
|
127 | + if (\count($context) !== 2){ |
|
128 | 128 | return $this->defaultFilter; |
129 | 129 | } |
130 | 130 | |
131 | 131 | // php {{ }} in javascript code (variable passing), use {! !} to bypass the filter |
132 | - if ($context[0] instanceof Verbatim && $context[1] instanceof Tag && $context[1]->name === 'script') { |
|
132 | + if ($context[0] instanceof Verbatim && $context[1] instanceof Tag && $context[1]->name === 'script'){ |
|
133 | 133 | return \sprintf( |
134 | 134 | 'json_encode(%s, %s, %s)', |
135 | 135 | '%s', |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | } |
140 | 140 | |
141 | 141 | // in on* and other attributes |
142 | - if ($context[0] instanceof Verbatim && $context[1] instanceof Attr && $context[1]->name !== 'style') { |
|
142 | + if ($context[0] instanceof Verbatim && $context[1] instanceof Attr && $context[1]->name !== 'style'){ |
|
143 | 143 | return \sprintf("'%s', %s, '%s'", '"', $this->defaultFilter, '"'); |
144 | 144 | } |
145 | 145 |
@@ -22,13 +22,13 @@ discard block |
||
22 | 22 | |
23 | 23 | public function enterNode(mixed $node, VisitorContext $ctx): mixed |
24 | 24 | { |
25 | - if ($node instanceof Tag) { |
|
25 | + if ($node instanceof Tag){ |
|
26 | 26 | return $this->makeBlock($node); |
27 | 27 | } |
28 | 28 | |
29 | - if ($node instanceof Inline) { |
|
29 | + if ($node instanceof Inline){ |
|
30 | 30 | $block = new Block($node->name, $node->getContext()); |
31 | - if ($node->value !== null) { |
|
31 | + if ($node->value !== null){ |
|
32 | 32 | $block->nodes[] = new Raw($node->value); |
33 | 33 | } |
34 | 34 | |
@@ -49,14 +49,14 @@ discard block |
||
49 | 49 | private function makeBlock(Tag $node): ?NodeInterface |
50 | 50 | { |
51 | 51 | $name = null; |
52 | - foreach ($this->prefix as $prefix) { |
|
53 | - if (\str_starts_with($node->name, (string) $prefix)) { |
|
54 | - $name = \substr($node->name, \strlen((string) $prefix)); |
|
52 | + foreach ($this->prefix as $prefix){ |
|
53 | + if (\str_starts_with($node->name, (string)$prefix)){ |
|
54 | + $name = \substr($node->name, \strlen((string)$prefix)); |
|
55 | 55 | break; |
56 | 56 | } |
57 | 57 | } |
58 | 58 | |
59 | - if ($name === null) { |
|
59 | + if ($name === null){ |
|
60 | 60 | return null; |
61 | 61 | } |
62 | 62 |
@@ -22,13 +22,16 @@ discard block |
||
22 | 22 | |
23 | 23 | public function enterNode(mixed $node, VisitorContext $ctx): mixed |
24 | 24 | { |
25 | - if ($node instanceof Tag) { |
|
25 | + if ($node instanceof Tag) |
|
26 | + { |
|
26 | 27 | return $this->makeBlock($node); |
27 | 28 | } |
28 | 29 | |
29 | - if ($node instanceof Inline) { |
|
30 | + if ($node instanceof Inline) |
|
31 | + { |
|
30 | 32 | $block = new Block($node->name, $node->getContext()); |
31 | - if ($node->value !== null) { |
|
33 | + if ($node->value !== null) |
|
34 | + { |
|
32 | 35 | $block->nodes[] = new Raw($node->value); |
33 | 36 | } |
34 | 37 | |
@@ -49,14 +52,17 @@ discard block |
||
49 | 52 | private function makeBlock(Tag $node): ?NodeInterface |
50 | 53 | { |
51 | 54 | $name = null; |
52 | - foreach ($this->prefix as $prefix) { |
|
53 | - if (\str_starts_with($node->name, (string) $prefix)) { |
|
55 | + foreach ($this->prefix as $prefix) |
|
56 | + { |
|
57 | + if (\str_starts_with($node->name, (string) $prefix)) |
|
58 | + { |
|
54 | 59 | $name = \substr($node->name, \strlen((string) $prefix)); |
55 | 60 | break; |
56 | 61 | } |
57 | 62 | } |
58 | 63 | |
59 | - if ($name === null) { |
|
64 | + if ($name === null) |
|
65 | + { |
|
60 | 66 | return null; |
61 | 67 | } |
62 | 68 |
@@ -67,13 +67,16 @@ discard block |
||
67 | 67 | */ |
68 | 68 | public function parse(Buffer $src): \Generator |
69 | 69 | { |
70 | - while ($n = $src->next()) { |
|
71 | - if (!$n instanceof Byte) { |
|
70 | + while ($n = $src->next()) |
|
71 | + { |
|
72 | + if (!$n instanceof Byte) |
|
73 | + { |
|
72 | 74 | yield $n; |
73 | 75 | continue; |
74 | 76 | } |
75 | 77 | |
76 | - if ($n->char === DirectiveGrammar::DIRECTIVE_CHAR) { |
|
78 | + if ($n->char === DirectiveGrammar::DIRECTIVE_CHAR) |
|
79 | + { |
|
77 | 80 | if ( |
78 | 81 | $this->echo->nextToken($src) || |
79 | 82 | $this->raw->nextToken($src) || |
@@ -85,11 +88,15 @@ discard block |
||
85 | 88 | } |
86 | 89 | |
87 | 90 | $directive = new DirectiveGrammar(); |
88 | - if ($directive->parse($src, $n->offset)) { |
|
89 | - if (\strtolower($directive->getKeyword()) === self::DECLARE_DIRECTIVE) { |
|
91 | + if ($directive->parse($src, $n->offset)) |
|
92 | + { |
|
93 | + if (\strtolower($directive->getKeyword()) === self::DECLARE_DIRECTIVE) |
|
94 | + { |
|
90 | 95 | // configure braces syntax |
91 | 96 | $this->declare($directive->getBody()); |
92 | - } else { |
|
97 | + } |
|
98 | + else |
|
99 | + { |
|
93 | 100 | if ( |
94 | 101 | $this->directiveRenderer !== null |
95 | 102 | && !$this->directiveRenderer->hasDirective($directive->getKeyword()) |
@@ -114,15 +121,20 @@ discard block |
||
114 | 121 | |
115 | 122 | /** @var BracesGrammar|null $braces */ |
116 | 123 | $braces = null; |
117 | - if ($this->echo->starts($src, $n)) { |
|
124 | + if ($this->echo->starts($src, $n)) |
|
125 | + { |
|
118 | 126 | $braces = clone $this->echo; |
119 | - } elseif ($this->raw->starts($src, $n)) { |
|
127 | + } |
|
128 | + elseif ($this->raw->starts($src, $n)) |
|
129 | + { |
|
120 | 130 | $braces = clone $this->raw; |
121 | 131 | } |
122 | 132 | |
123 | - if ($braces !== null) { |
|
133 | + if ($braces !== null) |
|
134 | + { |
|
124 | 135 | $echo = $braces->parse($src, $n); |
125 | - if ($echo !== null) { |
|
136 | + if ($echo !== null) |
|
137 | + { |
|
126 | 138 | yield from $echo; |
127 | 139 | continue; |
128 | 140 | } |
@@ -156,18 +168,22 @@ discard block |
||
156 | 168 | |
157 | 169 | private function declare(?string $body): void |
158 | 170 | { |
159 | - if ($body === null) { |
|
171 | + if ($body === null) |
|
172 | + { |
|
160 | 173 | return; |
161 | 174 | } |
162 | 175 | |
163 | - foreach ($this->fetchOptions($body) as $option => $value) { |
|
176 | + foreach ($this->fetchOptions($body) as $option => $value) |
|
177 | + { |
|
164 | 178 | $value = \trim((string) $value, '\'" '); |
165 | - switch ($option) { |
|
179 | + switch ($option) |
|
180 | + { |
|
166 | 181 | case 'syntax': |
167 | 182 | $this->echo->setActive($value !== 'off'); |
168 | 183 | $this->raw->setActive($value !== 'off'); |
169 | 184 | |
170 | - if ($value === 'default') { |
|
185 | + if ($value === 'default') |
|
186 | + { |
|
171 | 187 | $this->echo->setStartSequence('{{'); |
172 | 188 | $this->echo->setEndSequence('}}'); |
173 | 189 | $this->raw->setStartSequence('{!!'); |
@@ -204,10 +220,13 @@ discard block |
||
204 | 220 | $keyword = null; |
205 | 221 | |
206 | 222 | /** @var Token $token */ |
207 | - foreach ($lexer->parse(new StringStream($body)) as $token) { |
|
208 | - switch ($token->type) { |
|
223 | + foreach ($lexer->parse(new StringStream($body)) as $token) |
|
224 | + { |
|
225 | + switch ($token->type) |
|
226 | + { |
|
209 | 227 | case DeclareGrammar::TYPE_KEYWORD: |
210 | - if ($keyword !== null) { |
|
228 | + if ($keyword !== null) |
|
229 | + { |
|
211 | 230 | $options[$keyword] = $token->content; |
212 | 231 | $keyword = null; |
213 | 232 | break; |
@@ -215,7 +234,8 @@ discard block |
||
215 | 234 | $keyword = $token->content; |
216 | 235 | break; |
217 | 236 | case DeclareGrammar::TYPE_QUOTED: |
218 | - if ($keyword !== null) { |
|
237 | + if ($keyword !== null) |
|
238 | + { |
|
219 | 239 | $options[$keyword] = \trim($token->content, $token->content[0]); |
220 | 240 | $keyword = null; |
221 | 241 | break; |
@@ -224,7 +244,8 @@ discard block |
||
224 | 244 | $keyword = \trim($token->content, $token->content[0]); |
225 | 245 | break; |
226 | 246 | case DeclareGrammar::TYPE_COMMA: |
227 | - if ($keyword !== null) { |
|
247 | + if ($keyword !== null) |
|
248 | + { |
|
228 | 249 | $options[$keyword] = null; |
229 | 250 | $keyword = null; |
230 | 251 | break; |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | |
47 | 47 | public function __construct( |
48 | 48 | private readonly ?DirectiveRendererInterface $directiveRenderer = null, |
49 | - ) { |
|
49 | + ){ |
|
50 | 50 | $this->echo = new BracesGrammar( |
51 | 51 | '{{', |
52 | 52 | '}}', |
@@ -85,33 +85,33 @@ discard block |
||
85 | 85 | */ |
86 | 86 | public function parse(Buffer $src): \Generator |
87 | 87 | { |
88 | - while ($n = $src->next()) { |
|
89 | - if (!$n instanceof Byte) { |
|
88 | + while ($n = $src->next()){ |
|
89 | + if (!$n instanceof Byte){ |
|
90 | 90 | yield $n; |
91 | 91 | continue; |
92 | 92 | } |
93 | 93 | |
94 | - if ($n->char === DirectiveGrammar::DIRECTIVE_CHAR) { |
|
94 | + if ($n->char === DirectiveGrammar::DIRECTIVE_CHAR){ |
|
95 | 95 | if ( |
96 | 96 | $this->echo->nextToken($src) || |
97 | 97 | $this->raw->nextToken($src) || |
98 | 98 | $src->lookaheadByte() === DirectiveGrammar::DIRECTIVE_CHAR |
99 | - ) { |
|
99 | + ){ |
|
100 | 100 | // escaped echo sequence, hide directive byte |
101 | 101 | yield $src->next(); |
102 | 102 | continue; |
103 | 103 | } |
104 | 104 | |
105 | 105 | $directive = new DirectiveGrammar(); |
106 | - if ($directive->parse($src, $n->offset)) { |
|
107 | - if (\strtolower($directive->getKeyword()) === self::DECLARE_DIRECTIVE) { |
|
106 | + if ($directive->parse($src, $n->offset)){ |
|
107 | + if (\strtolower($directive->getKeyword()) === self::DECLARE_DIRECTIVE){ |
|
108 | 108 | // configure braces syntax |
109 | 109 | $this->declare($directive->getBody()); |
110 | - } else { |
|
110 | + }else{ |
|
111 | 111 | if ( |
112 | 112 | $this->directiveRenderer !== null |
113 | 113 | && !$this->directiveRenderer->hasDirective($directive->getKeyword()) |
114 | - ) { |
|
114 | + ){ |
|
115 | 115 | // directive opening char |
116 | 116 | yield $n; |
117 | 117 | |
@@ -136,15 +136,15 @@ discard block |
||
136 | 136 | |
137 | 137 | /** @var BracesGrammar|null $braces */ |
138 | 138 | $braces = null; |
139 | - if ($this->echo->starts($src, $n)) { |
|
139 | + if ($this->echo->starts($src, $n)){ |
|
140 | 140 | $braces = clone $this->echo; |
141 | - } elseif ($this->raw->starts($src, $n)) { |
|
141 | + } elseif ($this->raw->starts($src, $n)){ |
|
142 | 142 | $braces = clone $this->raw; |
143 | 143 | } |
144 | 144 | |
145 | - if ($braces !== null) { |
|
145 | + if ($braces !== null){ |
|
146 | 146 | $echo = $braces->parse($src, $n); |
147 | - if ($echo !== null) { |
|
147 | + if ($echo !== null){ |
|
148 | 148 | yield from $echo; |
149 | 149 | continue; |
150 | 150 | } |
@@ -158,20 +158,20 @@ discard block |
||
158 | 158 | yield from $src; |
159 | 159 | } |
160 | 160 | |
161 | - private function declare(?string $body): void |
|
161 | + private function declare(?string$body) : void |
|
162 | 162 | { |
163 | - if ($body === null) { |
|
163 | + if ($body === null){ |
|
164 | 164 | return; |
165 | 165 | } |
166 | 166 | |
167 | - foreach ($this->fetchOptions($body) as $option => $value) { |
|
168 | - $value = \trim((string) $value, '\'" '); |
|
169 | - switch ($option) { |
|
167 | + foreach ($this->fetchOptions($body) as $option => $value){ |
|
168 | + $value = \trim((string)$value, '\'" '); |
|
169 | + switch ($option){ |
|
170 | 170 | case 'syntax': |
171 | 171 | $this->echo->setActive($value !== 'off'); |
172 | 172 | $this->raw->setActive($value !== 'off'); |
173 | 173 | |
174 | - if ($value === 'default') { |
|
174 | + if ($value === 'default'){ |
|
175 | 175 | $this->echo->setStartSequence('{{'); |
176 | 176 | $this->echo->setEndSequence('}}'); |
177 | 177 | $this->raw->setStartSequence('{!!'); |
@@ -208,10 +208,10 @@ discard block |
||
208 | 208 | $keyword = null; |
209 | 209 | |
210 | 210 | /** @var Token $token */ |
211 | - foreach ($lexer->parse(new StringStream($body)) as $token) { |
|
212 | - switch ($token->type) { |
|
211 | + foreach ($lexer->parse(new StringStream($body)) as $token){ |
|
212 | + switch ($token->type){ |
|
213 | 213 | case DeclareGrammar::TYPE_KEYWORD: |
214 | - if ($keyword !== null) { |
|
214 | + if ($keyword !== null){ |
|
215 | 215 | $options[$keyword] = $token->content; |
216 | 216 | $keyword = null; |
217 | 217 | break; |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | $keyword = $token->content; |
220 | 220 | break; |
221 | 221 | case DeclareGrammar::TYPE_QUOTED: |
222 | - if ($keyword !== null) { |
|
222 | + if ($keyword !== null){ |
|
223 | 223 | $options[$keyword] = \trim($token->content, $token->content[0]); |
224 | 224 | $keyword = null; |
225 | 225 | break; |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | $keyword = \trim($token->content, $token->content[0]); |
229 | 229 | break; |
230 | 230 | case DeclareGrammar::TYPE_COMMA: |
231 | - if ($keyword !== null) { |
|
231 | + if ($keyword !== null){ |
|
232 | 232 | $options[$keyword] = null; |
233 | 233 | $keyword = null; |
234 | 234 | break; |
@@ -39,14 +39,14 @@ |
||
39 | 39 | { |
40 | 40 | $declaration = $this->createDeclaration(CommandDeclaration::class, [ |
41 | 41 | 'description' => $this->description, |
42 | - 'alias' => $this->alias ?? \strtolower((string) \preg_replace('/(?<!^)[A-Z]/', ':$0', $this->name)), |
|
42 | + 'alias' => $this->alias ?? \strtolower((string)\preg_replace('/(?<!^)[A-Z]/', ':$0', $this->name)), |
|
43 | 43 | ]); |
44 | 44 | |
45 | - foreach ($this->arguments as $argument) { |
|
45 | + foreach ($this->arguments as $argument){ |
|
46 | 46 | $declaration->addArgument($argument); |
47 | 47 | } |
48 | 48 | |
49 | - foreach ($this->options as $option) { |
|
49 | + foreach ($this->options as $option){ |
|
50 | 50 | $declaration->addOption($option); |
51 | 51 | } |
52 | 52 |
@@ -42,11 +42,13 @@ |
||
42 | 42 | 'alias' => $this->alias ?? \strtolower((string) \preg_replace('/(?<!^)[A-Z]/', ':$0', $this->name)), |
43 | 43 | ]); |
44 | 44 | |
45 | - foreach ($this->arguments as $argument) { |
|
45 | + foreach ($this->arguments as $argument) |
|
46 | + { |
|
46 | 47 | $declaration->addArgument($argument); |
47 | 48 | } |
48 | 49 | |
49 | - foreach ($this->options as $option) { |
|
50 | + foreach ($this->options as $option) |
|
51 | + { |
|
50 | 52 | $declaration->addOption($option); |
51 | 53 | } |
52 | 54 |
@@ -27,22 +27,28 @@ discard block |
||
27 | 27 | MagicCallTrait::class, |
28 | 28 | ] : []; |
29 | 29 | |
30 | - if (\str_contains($className, '\\')) { |
|
30 | + if (\str_contains($className, '\\')) |
|
31 | + { |
|
31 | 32 | $classShortName = \substr($className, \strrpos($className, '\\') + 1); |
32 | 33 | $classNamespaceStr = 'namespace ' . \substr($className, 0, \strrpos($className, '\\')) . ';'; |
33 | - } else { |
|
34 | + } |
|
35 | + else |
|
36 | + { |
|
34 | 37 | $classShortName = $className; |
35 | 38 | $classNamespaceStr = ''; |
36 | 39 | } |
37 | 40 | |
38 | 41 | $interface = $type->getName(); |
39 | 42 | $classBody = []; |
40 | - foreach ($type->getMethods() as $method) { |
|
41 | - if ($method->isConstructor()) { |
|
43 | + foreach ($type->getMethods() as $method) |
|
44 | + { |
|
45 | + if ($method->isConstructor()) |
|
46 | + { |
|
42 | 47 | throw new \LogicException('Constructor is not allowed in a proxy.'); |
43 | 48 | } |
44 | 49 | |
45 | - if ($method->isDestructor()) { |
|
50 | + if ($method->isDestructor()) |
|
51 | + { |
|
46 | 52 | $classBody[] = self::renderMethod($method); |
47 | 53 | continue; |
48 | 54 | } |
@@ -69,12 +75,14 @@ discard block |
||
69 | 75 | PHP; |
70 | 76 | |
71 | 77 | $args = []; |
72 | - foreach ($method->getParameters() as $param) { |
|
78 | + foreach ($method->getParameters() as $param) |
|
79 | + { |
|
73 | 80 | $hasRefs = $hasRefs || $param->isPassedByReference(); |
74 | 81 | $args[] = ($param->isVariadic() ? '...' : '') . '$' . $param->getName(); |
75 | 82 | } |
76 | 83 | |
77 | - if (!$hasRefs && !$method->isVariadic()) { |
|
84 | + if (!$hasRefs && !$method->isVariadic()) |
|
85 | + { |
|
78 | 86 | $classBody[] = self::renderMethod( |
79 | 87 | $method, |
80 | 88 | <<<PHP |
@@ -86,7 +94,8 @@ discard block |
||
86 | 94 | |
87 | 95 | $argsStr = \implode(', ', $args); |
88 | 96 | |
89 | - if ($method->isVariadic()) { |
|
97 | + if ($method->isVariadic()) |
|
98 | + { |
|
90 | 99 | $classBody[] = self::renderMethod( |
91 | 100 | $method, |
92 | 101 | <<<PHP |
@@ -154,7 +163,8 @@ discard block |
||
154 | 163 | |
155 | 164 | public static function renderParameterTypes(\ReflectionType $types, \ReflectionClass $class): string |
156 | 165 | { |
157 | - if ($types instanceof \ReflectionNamedType) { |
|
166 | + if ($types instanceof \ReflectionNamedType) |
|
167 | + { |
|
158 | 168 | return ($types->allowsNull() && $types->getName() !== 'mixed' ? '?' : '') . ($types->isBuiltin() |
159 | 169 | ? $types->getName() |
160 | 170 | : self::normalizeClassType($types, $class)); |
@@ -167,7 +177,8 @@ discard block |
||
167 | 177 | }; |
168 | 178 | |
169 | 179 | $result = []; |
170 | - foreach ($types as $type) { |
|
180 | + foreach ($types as $type) |
|
181 | + { |
|
171 | 182 | $result[] = $type->isBuiltin() |
172 | 183 | ? $type->getName() |
173 | 184 | : self::normalizeClassType($type, $class); |
@@ -178,7 +189,8 @@ discard block |
||
178 | 189 | |
179 | 190 | public static function renderDefaultValue(\ReflectionParameter $param): string |
180 | 191 | { |
181 | - if ($param->isDefaultValueConstant()) { |
|
192 | + if ($param->isDefaultValueConstant()) |
|
193 | + { |
|
182 | 194 | $result = $param->getDefaultValueConstantName(); |
183 | 195 | |
184 | 196 | return \explode('::', (string) $result)[0] === 'self' |
@@ -27,29 +27,29 @@ discard block |
||
27 | 27 | MagicCallTrait::class, |
28 | 28 | ] : []; |
29 | 29 | |
30 | - if (\str_contains($className, '\\')) { |
|
30 | + if (\str_contains($className, '\\')){ |
|
31 | 31 | $classShortName = \substr($className, \strrpos($className, '\\') + 1); |
32 | - $classNamespaceStr = 'namespace ' . \substr($className, 0, \strrpos($className, '\\')) . ';'; |
|
33 | - } else { |
|
32 | + $classNamespaceStr = 'namespace '.\substr($className, 0, \strrpos($className, '\\')).';'; |
|
33 | + }else{ |
|
34 | 34 | $classShortName = $className; |
35 | 35 | $classNamespaceStr = ''; |
36 | 36 | } |
37 | 37 | |
38 | 38 | $interface = $type->getName(); |
39 | 39 | $classBody = []; |
40 | - foreach ($type->getMethods() as $method) { |
|
41 | - if ($method->isConstructor()) { |
|
40 | + foreach ($type->getMethods() as $method){ |
|
41 | + if ($method->isConstructor()){ |
|
42 | 42 | throw new \LogicException('Constructor is not allowed in a proxy.'); |
43 | 43 | } |
44 | 44 | |
45 | - if ($method->isDestructor()) { |
|
45 | + if ($method->isDestructor()){ |
|
46 | 46 | $classBody[] = self::renderMethod($method); |
47 | 47 | continue; |
48 | 48 | } |
49 | 49 | |
50 | 50 | $hasRefs = false; |
51 | - $return = $method->hasReturnType() && (string) $method->getReturnType() === 'void' ? '' : 'return '; |
|
52 | - $call = ($method->isStatic() ? '::' : '->') . $method->getName(); |
|
51 | + $return = $method->hasReturnType() && (string)$method->getReturnType() === 'void' ? '' : 'return '; |
|
52 | + $call = ($method->isStatic() ? '::' : '->').$method->getName(); |
|
53 | 53 | $context = $method->isStatic() ? 'null' : '$this->__container_proxy_context'; |
54 | 54 | $containerStr = match (false) { |
55 | 55 | $attachContainer => 'null', |
@@ -69,12 +69,12 @@ discard block |
||
69 | 69 | PHP; |
70 | 70 | |
71 | 71 | $args = []; |
72 | - foreach ($method->getParameters() as $param) { |
|
72 | + foreach ($method->getParameters() as $param){ |
|
73 | 73 | $hasRefs = $hasRefs || $param->isPassedByReference(); |
74 | - $args[] = ($param->isVariadic() ? '...' : '') . '$' . $param->getName(); |
|
74 | + $args[] = ($param->isVariadic() ? '...' : '').'$'.$param->getName(); |
|
75 | 75 | } |
76 | 76 | |
77 | - if (!$hasRefs && !$method->isVariadic()) { |
|
77 | + if (!$hasRefs && !$method->isVariadic()){ |
|
78 | 78 | $classBody[] = self::renderMethod( |
79 | 79 | $method, |
80 | 80 | <<<PHP |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | |
87 | 87 | $argsStr = \implode(', ', $args); |
88 | 88 | |
89 | - if ($method->isVariadic()) { |
|
89 | + if ($method->isVariadic()){ |
|
90 | 90 | $classBody[] = self::renderMethod( |
91 | 91 | $method, |
92 | 92 | <<<PHP |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | |
109 | 109 | $traitsStr = $traits === [] ? '' : \implode( |
110 | 110 | "\n ", |
111 | - \array_map(static fn(string $trait): string => 'use \\' . \ltrim($trait, '\\') . ';', $traits), |
|
111 | + \array_map(static fn(string $trait) : string => 'use \\'.\ltrim($trait, '\\').';', $traits), |
|
112 | 112 | ); |
113 | 113 | return <<<PHP |
114 | 114 | $classNamespaceStr |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | $m->getName(), |
132 | 132 | \implode(', ', \array_map(self::renderParameter(...), $m->getParameters())), |
133 | 133 | $m->hasReturnType() |
134 | - ? ': ' . self::renderParameterTypes($m->getReturnType(), $m->getDeclaringClass()) |
|
134 | + ? ': '.self::renderParameterTypes($m->getReturnType(), $m->getDeclaringClass()) |
|
135 | 135 | : '', |
136 | 136 | $body, |
137 | 137 | ); |
@@ -145,8 +145,8 @@ discard block |
||
145 | 145 | $param->hasType() ? 'mixed' : '', |
146 | 146 | $param->isPassedByReference() ? '&' : '', |
147 | 147 | $param->isVariadic() ? '...' : '', |
148 | - '$' . $param->getName(), |
|
149 | - $param->isOptional() && !$param->isVariadic() ? ' = ' . self::renderDefaultValue($param) : '', |
|
148 | + '$'.$param->getName(), |
|
149 | + $param->isOptional() && !$param->isVariadic() ? ' = '.self::renderDefaultValue($param) : '', |
|
150 | 150 | ), |
151 | 151 | ' ', |
152 | 152 | ); |
@@ -154,8 +154,8 @@ discard block |
||
154 | 154 | |
155 | 155 | public static function renderParameterTypes(\ReflectionType $types, \ReflectionClass $class): string |
156 | 156 | { |
157 | - if ($types instanceof \ReflectionNamedType) { |
|
158 | - return ($types->allowsNull() && $types->getName() !== 'mixed' ? '?' : '') . ($types->isBuiltin() |
|
157 | + if ($types instanceof \ReflectionNamedType){ |
|
158 | + return ($types->allowsNull() && $types->getName() !== 'mixed' ? '?' : '').($types->isBuiltin() |
|
159 | 159 | ? $types->getName() |
160 | 160 | : self::normalizeClassType($types, $class)); |
161 | 161 | } |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | }; |
168 | 168 | |
169 | 169 | $result = []; |
170 | - foreach ($types as $type) { |
|
170 | + foreach ($types as $type){ |
|
171 | 171 | $result[] = $type->isBuiltin() |
172 | 172 | ? $type->getName() |
173 | 173 | : self::normalizeClassType($type, $class); |
@@ -178,12 +178,12 @@ discard block |
||
178 | 178 | |
179 | 179 | public static function renderDefaultValue(\ReflectionParameter $param): string |
180 | 180 | { |
181 | - if ($param->isDefaultValueConstant()) { |
|
181 | + if ($param->isDefaultValueConstant()){ |
|
182 | 182 | $result = $param->getDefaultValueConstantName(); |
183 | 183 | |
184 | - return \explode('::', (string) $result)[0] === 'self' |
|
184 | + return \explode('::', (string)$result)[0] === 'self' |
|
185 | 185 | ? $result |
186 | - : '\\' . $result; |
|
186 | + : '\\'.$result; |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | $cut = self::cutDefaultValue($param); |
@@ -197,14 +197,14 @@ discard block |
||
197 | 197 | { |
198 | 198 | return match($type->getName()) { |
199 | 199 | 'static' => 'static', |
200 | - 'self' => '\\' . $class->getName(), |
|
201 | - default => '\\' . $type->getName(), |
|
200 | + 'self' => '\\'.$class->getName(), |
|
201 | + default => '\\'.$type->getName(), |
|
202 | 202 | }; |
203 | 203 | } |
204 | 204 | |
205 | 205 | private static function cutDefaultValue(\ReflectionParameter $param): string |
206 | 206 | { |
207 | - $string = (string) $param; |
|
207 | + $string = (string)$param; |
|
208 | 208 | |
209 | 209 | return \trim(\substr($string, \strpos($string, '=') + 1, -1)); |
210 | 210 | } |
@@ -18,23 +18,23 @@ discard block |
||
18 | 18 | { |
19 | 19 | $lines = \explode("\n", $comment); |
20 | 20 | |
21 | - foreach ($lines as $line) { |
|
21 | + foreach ($lines as $line){ |
|
22 | 22 | // strip up comment prefix |
23 | 23 | /** @var string $line */ |
24 | 24 | $line = \preg_replace('/[\t ]*[\/]?\*[\/]? ?/', '', $line); |
25 | 25 | |
26 | - if (\preg_match('/ *@([^ ]+) (.*)/u', $line, $matches)) { |
|
26 | + if (\preg_match('/ *@([^ ]+) (.*)/u', $line, $matches)){ |
|
27 | 27 | $this->lines[] = new Line($matches[2], $matches[1]); |
28 | - } else { |
|
28 | + }else{ |
|
29 | 29 | $this->lines[] = new Line($line); |
30 | 30 | } |
31 | 31 | } |
32 | 32 | |
33 | - if (isset($this->lines[0]) && $this->lines[0]->isEmpty()) { |
|
33 | + if (isset($this->lines[0]) && $this->lines[0]->isEmpty()){ |
|
34 | 34 | \array_shift($this->lines); |
35 | 35 | } |
36 | 36 | |
37 | - if (isset($this->lines[\count($this->lines) - 1]) && $this->lines[\count($this->lines) - 1]->isEmpty()) { |
|
37 | + if (isset($this->lines[\count($this->lines) - 1]) && $this->lines[\count($this->lines) - 1]->isEmpty()){ |
|
38 | 38 | \array_pop($this->lines); |
39 | 39 | } |
40 | 40 | } |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | $result[] = '/**'; |
46 | 46 | |
47 | 47 | // skip first and last tokens |
48 | - foreach ($this->lines as $line) { |
|
49 | - if ($line->type === null) { |
|
48 | + foreach ($this->lines as $line){ |
|
49 | + if ($line->type === null){ |
|
50 | 50 | $result[] = \sprintf(' * %s', $line->value); |
51 | 51 | continue; |
52 | 52 | } |
@@ -18,23 +18,29 @@ discard block |
||
18 | 18 | { |
19 | 19 | $lines = \explode("\n", $comment); |
20 | 20 | |
21 | - foreach ($lines as $line) { |
|
21 | + foreach ($lines as $line) |
|
22 | + { |
|
22 | 23 | // strip up comment prefix |
23 | 24 | /** @var string $line */ |
24 | 25 | $line = \preg_replace('/[\t ]*[\/]?\*[\/]? ?/', '', $line); |
25 | 26 | |
26 | - if (\preg_match('/ *@([^ ]+) (.*)/u', $line, $matches)) { |
|
27 | + if (\preg_match('/ *@([^ ]+) (.*)/u', $line, $matches)) |
|
28 | + { |
|
27 | 29 | $this->lines[] = new Line($matches[2], $matches[1]); |
28 | - } else { |
|
30 | + } |
|
31 | + else |
|
32 | + { |
|
29 | 33 | $this->lines[] = new Line($line); |
30 | 34 | } |
31 | 35 | } |
32 | 36 | |
33 | - if (isset($this->lines[0]) && $this->lines[0]->isEmpty()) { |
|
37 | + if (isset($this->lines[0]) && $this->lines[0]->isEmpty()) |
|
38 | + { |
|
34 | 39 | \array_shift($this->lines); |
35 | 40 | } |
36 | 41 | |
37 | - if (isset($this->lines[\count($this->lines) - 1]) && $this->lines[\count($this->lines) - 1]->isEmpty()) { |
|
42 | + if (isset($this->lines[\count($this->lines) - 1]) && $this->lines[\count($this->lines) - 1]->isEmpty()) |
|
43 | + { |
|
38 | 44 | \array_pop($this->lines); |
39 | 45 | } |
40 | 46 | } |
@@ -45,8 +51,10 @@ discard block |
||
45 | 51 | $result[] = '/**'; |
46 | 52 | |
47 | 53 | // skip first and last tokens |
48 | - foreach ($this->lines as $line) { |
|
49 | - if ($line->type === null) { |
|
54 | + foreach ($this->lines as $line) |
|
55 | + { |
|
56 | + if ($line->type === null) |
|
57 | + { |
|
50 | 58 | $result[] = \sprintf(' * %s', $line->value); |
51 | 59 | continue; |
52 | 60 | } |