Skip to content

Commit 891d9ff

Browse files
committed
Move UnionKeyword to Parsers
Signed-off-by: Kamil Tekiela <[email protected]>
1 parent ef954bb commit 891d9ff

File tree

2 files changed

+9
-19
lines changed

2 files changed

+9
-19
lines changed

src/Components/UnionKeyword.php renamed to src/Components/Parsers/UnionKeywords.php

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22

33
declare(strict_types=1);
44

5-
namespace PhpMyAdmin\SqlParser\Components;
5+
namespace PhpMyAdmin\SqlParser\Components\Parsers;
66

7-
use PhpMyAdmin\SqlParser\Component;
87
use PhpMyAdmin\SqlParser\Parseable;
98
use PhpMyAdmin\SqlParser\Parser;
109
use PhpMyAdmin\SqlParser\TokensList;
1110
use PhpMyAdmin\SqlParser\Translator;
1211
use RuntimeException;
12+
use Stringable;
1313

1414
use function implode;
1515

1616
/**
1717
* `UNION` keyword builder.
1818
*/
19-
final class UnionKeyword implements Component, Parseable
19+
final class UnionKeywords implements Parseable
2020
{
2121
/**
2222
* Parses the tokens contained in the given list in the context of the given parser.
@@ -32,12 +32,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
3232
throw new RuntimeException(Translator::gettext('Not implemented yet.'));
3333
}
3434

35-
public function build(): string
36-
{
37-
throw new RuntimeException(Translator::gettext('Not implemented yet.'));
38-
}
39-
40-
/** @param UnionKeyword[][] $component the component to be built */
35+
/** @param list<array{string|Stringable,string|Stringable}> $component the component to be built */
4136
public static function buildAll(array $component): string
4237
{
4338
$tmp = [];
@@ -47,9 +42,4 @@ public static function buildAll(array $component): string
4742

4843
return implode(' ', $tmp);
4944
}
50-
51-
public function __toString(): string
52-
{
53-
return $this->build();
54-
}
5545
}

src/Parser.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,23 +131,23 @@ class Parser
131131
],
132132

133133
'INTERSECT' => [
134-
'class' => Components\UnionKeyword::class,
134+
'class' => Components\Parsers\UnionKeywords::class,
135135
'field' => 'union',
136136
],
137137
'EXCEPT' => [
138-
'class' => Components\UnionKeyword::class,
138+
'class' => Components\Parsers\UnionKeywords::class,
139139
'field' => 'union',
140140
],
141141
'UNION' => [
142-
'class' => Components\UnionKeyword::class,
142+
'class' => Components\Parsers\UnionKeywords::class,
143143
'field' => 'union',
144144
],
145145
'UNION ALL' => [
146-
'class' => Components\UnionKeyword::class,
146+
'class' => Components\Parsers\UnionKeywords::class,
147147
'field' => 'union',
148148
],
149149
'UNION DISTINCT' => [
150-
'class' => Components\UnionKeyword::class,
150+
'class' => Components\Parsers\UnionKeywords::class,
151151
'field' => 'union',
152152
],
153153

0 commit comments

Comments
 (0)