Skip to content

Commit

Permalink
Move UnionKeyword to Parsers
Browse files Browse the repository at this point in the history
Signed-off-by: Kamil Tekiela <[email protected]>
  • Loading branch information
kamil-tekiela committed Jan 16, 2024
1 parent ef954bb commit 891d9ff
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@

declare(strict_types=1);

namespace PhpMyAdmin\SqlParser\Components;
namespace PhpMyAdmin\SqlParser\Components\Parsers;

use PhpMyAdmin\SqlParser\Component;
use PhpMyAdmin\SqlParser\Parseable;
use PhpMyAdmin\SqlParser\Parser;
use PhpMyAdmin\SqlParser\TokensList;
use PhpMyAdmin\SqlParser\Translator;
use RuntimeException;
use Stringable;

use function implode;

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

public function build(): string
{
throw new RuntimeException(Translator::gettext('Not implemented yet.'));
}

/** @param UnionKeyword[][] $component the component to be built */
/** @param list<array{string|Stringable,string|Stringable}> $component the component to be built */
public static function buildAll(array $component): string

Check failure on line 36 in src/Components/Parsers/UnionKeywords.php

View workflow job for this annotation

GitHub Actions / lint-docs

Invalid @param tag on "buildAll": "list<array{string|Stringable,string|Stringable}> $component the component to be built" on "PhpMyAdmin\SqlParser\Components\Parsers\UnionKeywords::buildAll"

Check failure on line 36 in src/Components/Parsers/UnionKeywords.php

View workflow job for this annotation

GitHub Actions / lint-docs

The method "buildAll" has "1" invalid @param tags. on "PhpMyAdmin\SqlParser\Components\Parsers\UnionKeywords::buildAll"
{
$tmp = [];
Expand All @@ -47,9 +42,4 @@ public static function buildAll(array $component): string

return implode(' ', $tmp);
}

public function __toString(): string
{
return $this->build();
}
}
10 changes: 5 additions & 5 deletions src/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,23 +131,23 @@ class Parser
],

'INTERSECT' => [
'class' => Components\UnionKeyword::class,
'class' => Components\Parsers\UnionKeywords::class,
'field' => 'union',
],
'EXCEPT' => [
'class' => Components\UnionKeyword::class,
'class' => Components\Parsers\UnionKeywords::class,
'field' => 'union',
],
'UNION' => [
'class' => Components\UnionKeyword::class,
'class' => Components\Parsers\UnionKeywords::class,
'field' => 'union',
],
'UNION ALL' => [
'class' => Components\UnionKeyword::class,
'class' => Components\Parsers\UnionKeywords::class,
'field' => 'union',
],
'UNION DISTINCT' => [
'class' => Components\UnionKeyword::class,
'class' => Components\Parsers\UnionKeywords::class,
'field' => 'union',
],

Expand Down

0 comments on commit 891d9ff

Please sign in to comment.