@@ -19,10 +19,10 @@ |
||
19 | 19 | use ContextTrait; |
20 | 20 | |
21 | 21 | public function __construct( |
22 | - public Mixin|string $name, |
|
22 | + public Mixin | string $name, |
|
23 | 23 | public mixed $value, |
24 | 24 | Context $context = null |
25 | - ) { |
|
25 | + ){ |
|
26 | 26 | $this->context = $context; |
27 | 27 | } |
28 | 28 |
@@ -24,7 +24,7 @@ |
||
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 = []; |
@@ -24,7 +24,7 @@ |
||
24 | 24 | */ |
25 | 25 | public function __construct( |
26 | 26 | public array $nodes = [] |
27 | - ) { |
|
27 | + ){ |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | public function setContext(Context $context = null): void |
@@ -17,9 +17,9 @@ |
||
17 | 17 | use ContextTrait; |
18 | 18 | |
19 | 19 | public function __construct( |
20 | - public string|int|float $content, |
|
20 | + public string | int | float $content, |
|
21 | 21 | Context $context = null |
22 | - ) { |
|
22 | + ){ |
|
23 | 23 | $this->context = $context; |
24 | 24 | } |
25 | 25 |
@@ -23,7 +23,7 @@ |
||
23 | 23 | /** @internal */ |
24 | 24 | public array $tokens, |
25 | 25 | Context $context = null |
26 | - ) { |
|
26 | + ){ |
|
27 | 27 | $this->context = $context; |
28 | 28 | } |
29 | 29 |
@@ -15,7 +15,7 @@ |
||
15 | 15 | string $message, |
16 | 16 | private Context $context, |
17 | 17 | \Throwable $previous = null |
18 | - ) { |
|
18 | + ){ |
|
19 | 19 | parent::__construct($message, 0, $previous); |
20 | 20 | } |
21 | 21 |
@@ -15,7 +15,7 @@ |
||
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 | } |
@@ -12,10 +12,10 @@ |
||
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 |
@@ -14,8 +14,10 @@ |
||
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 |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | |
24 | 24 | public function handle(Parser $parser, Assembler $asm, Token $token): void |
25 | 25 | { |
26 | - switch ($token->type) { |
|
26 | + switch ($token->type){ |
|
27 | 27 | case DynamicGrammar::TYPE_DIRECTIVE: |
28 | 28 | $this->directive = new Directive(new Parser\Context($token, $parser->getPath())); |
29 | 29 | $asm->push($this->directive); |
@@ -48,20 +48,20 @@ discard block |
||
48 | 48 | break; |
49 | 49 | |
50 | 50 | case DynamicGrammar::TYPE_KEYWORD: |
51 | - if ($this->directive !== null) { |
|
51 | + if ($this->directive !== null){ |
|
52 | 52 | $this->directive->name = $token->content; |
53 | 53 | } |
54 | 54 | break; |
55 | 55 | |
56 | 56 | case DynamicGrammar::TYPE_BODY: |
57 | - if ($this->directive !== null) { |
|
57 | + if ($this->directive !== null){ |
|
58 | 58 | $this->directive->body = $token->content; |
59 | 59 | $this->directive->values = $this->fetchValues($this->directive->body); |
60 | 60 | |
61 | 61 | $this->directive = null; |
62 | 62 | } |
63 | 63 | |
64 | - if ($this->output !== null) { |
|
64 | + if ($this->output !== null){ |
|
65 | 65 | $this->output->body = $token->content; |
66 | 66 | } |
67 | 67 | |
@@ -79,31 +79,31 @@ discard block |
||
79 | 79 | |
80 | 80 | $src = new StringStream($body); |
81 | 81 | |
82 | - while ($n = $src->peak()) { |
|
83 | - if (\in_array($n, ['"', '"'])) { |
|
82 | + while ($n = $src->peak()){ |
|
83 | + if (\in_array($n, ['"', '"'])){ |
|
84 | 84 | $values[\count($values) - 1] .= $n; |
85 | - while ($nn = $src->peak()) { |
|
85 | + while ($nn = $src->peak()){ |
|
86 | 86 | $values[\count($values) - 1] .= $nn; |
87 | - if ($nn === $n) { |
|
87 | + if ($nn === $n){ |
|
88 | 88 | break; |
89 | 89 | } |
90 | 90 | } |
91 | 91 | continue; |
92 | 92 | } |
93 | 93 | |
94 | - if ($n === ',' && $level === 0) { |
|
94 | + if ($n === ',' && $level === 0){ |
|
95 | 95 | $values[] = ''; |
96 | 96 | continue; |
97 | 97 | } |
98 | 98 | |
99 | 99 | $values[\count($values) - 1] .= $n; |
100 | 100 | |
101 | - if ($n === '(' || $n === '[' || $n === '{') { |
|
101 | + if ($n === '(' || $n === '[' || $n === '{'){ |
|
102 | 102 | $level++; |
103 | 103 | continue; |
104 | 104 | } |
105 | 105 | |
106 | - if ($n === ')' || $n === ']' || $n === '}') { |
|
106 | + if ($n === ')' || $n === ']' || $n === '}'){ |
|
107 | 107 | $level--; |
108 | 108 | } |
109 | 109 | } |
@@ -23,7 +23,8 @@ discard block |
||
23 | 23 | |
24 | 24 | public function handle(Parser $parser, Assembler $asm, Token $token): void |
25 | 25 | { |
26 | - switch ($token->type) { |
|
26 | + switch ($token->type) |
|
27 | + { |
|
27 | 28 | case DynamicGrammar::TYPE_DIRECTIVE: |
28 | 29 | $this->directive = new Directive(new Parser\Context($token, $parser->getPath())); |
29 | 30 | $asm->push($this->directive); |
@@ -48,20 +49,23 @@ discard block |
||
48 | 49 | break; |
49 | 50 | |
50 | 51 | case DynamicGrammar::TYPE_KEYWORD: |
51 | - if ($this->directive !== null) { |
|
52 | + if ($this->directive !== null) |
|
53 | + { |
|
52 | 54 | $this->directive->name = $token->content; |
53 | 55 | } |
54 | 56 | break; |
55 | 57 | |
56 | 58 | case DynamicGrammar::TYPE_BODY: |
57 | - if ($this->directive !== null) { |
|
59 | + if ($this->directive !== null) |
|
60 | + { |
|
58 | 61 | $this->directive->body = $token->content; |
59 | 62 | $this->directive->values = $this->fetchValues($this->directive->body); |
60 | 63 | |
61 | 64 | $this->directive = null; |
62 | 65 | } |
63 | 66 | |
64 | - if ($this->output !== null) { |
|
67 | + if ($this->output !== null) |
|
68 | + { |
|
65 | 69 | $this->output->body = $token->content; |
66 | 70 | } |
67 | 71 | |
@@ -79,31 +83,38 @@ discard block |
||
79 | 83 | |
80 | 84 | $src = new StringStream($body); |
81 | 85 | |
82 | - while ($n = $src->peak()) { |
|
83 | - if (\in_array($n, ['"', '"'])) { |
|
86 | + while ($n = $src->peak()) |
|
87 | + { |
|
88 | + if (\in_array($n, ['"', '"'])) |
|
89 | + { |
|
84 | 90 | $values[\count($values) - 1] .= $n; |
85 | - while ($nn = $src->peak()) { |
|
91 | + while ($nn = $src->peak()) |
|
92 | + { |
|
86 | 93 | $values[\count($values) - 1] .= $nn; |
87 | - if ($nn === $n) { |
|
94 | + if ($nn === $n) |
|
95 | + { |
|
88 | 96 | break; |
89 | 97 | } |
90 | 98 | } |
91 | 99 | continue; |
92 | 100 | } |
93 | 101 | |
94 | - if ($n === ',' && $level === 0) { |
|
102 | + if ($n === ',' && $level === 0) |
|
103 | + { |
|
95 | 104 | $values[] = ''; |
96 | 105 | continue; |
97 | 106 | } |
98 | 107 | |
99 | 108 | $values[\count($values) - 1] .= $n; |
100 | 109 | |
101 | - if ($n === '(' || $n === '[' || $n === '{') { |
|
110 | + if ($n === '(' || $n === '[' || $n === '{') |
|
111 | + { |
|
102 | 112 | $level++; |
103 | 113 | continue; |
104 | 114 | } |
105 | 115 | |
106 | - if ($n === ')' || $n === ']' || $n === '}') { |
|
116 | + if ($n === ')' || $n === ']' || $n === '}') |
|
117 | + { |
|
107 | 118 | $level--; |
108 | 119 | } |
109 | 120 | } |