diff --git a/phpcs.xml.dist b/phpcs.xml.dist
index 07e829c2d..9febb1853 100644
--- a/phpcs.xml.dist
+++ b/phpcs.xml.dist
@@ -28,48 +28,14 @@
tests/Tools/templates/*
-
- src/Context.php
-
-
-
- 4
-
-
- 4
-
-
- 4
-
4
-
- 4
-
-
- 4
-
-
- 4
-
-
- 4
-
-
- 4
-
4
4
-
- 4
-
-
- 4
-
diff --git a/psalm-baseline.xml b/psalm-baseline.xml
index 0dfd28bcc..d769180a1 100644
--- a/psalm-baseline.xml
+++ b/psalm-baseline.xml
@@ -1,5 +1,5 @@
-
+
$options
@@ -8,7 +8,7 @@
PartitionDefinition::class]
+ ['type' => PartitionDefinition::class],
)]]>
@@ -20,7 +20,7 @@
@@ -374,14 +374,14 @@
[
'parenthesesDelimited' => true,
'breakOnAlias' => true,
- ]
+ ],
)]]>
self::class]
+ ['type' => self::class],
)]]>
@@ -401,7 +401,7 @@
[
'parseField' => 'table',
'breakOnAlias' => true,
- ]
+ ],
)]]>
@@ -415,7 +415,7 @@
[
'breakOnAlias' => true,
'parseField' => 'table',
- ]
+ ],
)]]>
true,
'parseField' => 'table',
- ]
+ ],
)]]>
@@ -780,7 +780,7 @@
PartitionDefinition::class]
+ ['type' => PartitionDefinition::class],
)]]>
ArrayObj::parse($parser, $list)
diff --git a/src/Components/AlterOperation.php b/src/Components/AlterOperation.php
index 59fd3daed..95575d73d 100644
--- a/src/Components/AlterOperation.php
+++ b/src/Components/AlterOperation.php
@@ -267,7 +267,7 @@ public function __construct(
OptionsArray|null $options = null,
Expression|string|null $field = null,
array|null $partitions = null,
- public array $unknown = []
+ public array $unknown = [],
) {
$this->partitions = $partitions;
$this->options = $options;
@@ -370,7 +370,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
[
'breakOnAlias' => true,
'parseField' => 'column',
- ]
+ ],
);
if ($ret->field === null) {
// No field was read. We go back one token so the next
@@ -417,7 +417,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
// a start to new statement, but have not found a delimiter between them
$parser->error(
'A new statement was found, but no delimiter between it and the previous one.',
- $token
+ $token,
);
break;
}
@@ -481,7 +481,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
$ret->partitions = ArrayObj::parse(
$parser,
$list,
- ['type' => PartitionDefinition::class]
+ ['type' => PartitionDefinition::class],
);
}
}
diff --git a/src/Components/Array2d.php b/src/Components/Array2d.php
index 02e3e1eec..90a402d2f 100644
--- a/src/Components/Array2d.php
+++ b/src/Components/Array2d.php
@@ -88,9 +88,9 @@ public static function parse(Parser $parser, TokensList $list, array $options =
sprintf(
Translator::gettext('%1$d values were expected, but found %2$d.'),
$count,
- $arrCount
+ $arrCount,
),
- $token
+ $token,
);
}
diff --git a/src/Components/ArrayObj.php b/src/Components/ArrayObj.php
index 50ca1ac14..a42632580 100644
--- a/src/Components/ArrayObj.php
+++ b/src/Components/ArrayObj.php
@@ -138,7 +138,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
$ret[] = $options['type']::parse(
$parser,
$list,
- empty($options['typeOptions']) ? [] : $options['typeOptions']
+ empty($options['typeOptions']) ? [] : $options['typeOptions'],
);
}
}
@@ -170,9 +170,7 @@ public function build(): string
return '(' . implode(', ', $this->values) . ')';
}
- /**
- * @param ArrayObj[] $component the component to be built
- */
+ /** @param ArrayObj[] $component the component to be built */
public static function buildAll(array $component): string
{
return implode(', ', $component);
diff --git a/src/Components/Condition.php b/src/Components/Condition.php
index 7324b6ac7..0bc14aaff 100644
--- a/src/Components/Condition.php
+++ b/src/Components/Condition.php
@@ -77,9 +77,7 @@ final class Condition implements Component
*/
public $expr;
- /**
- * @param string $expr the condition or the operator
- */
+ /** @param string $expr the condition or the operator */
public function __construct(string|null $expr = null)
{
$this->expr = trim((string) $expr);
@@ -222,9 +220,7 @@ public function build(): string
return $this->expr;
}
- /**
- * @param Condition[] $component the component to be built
- */
+ /** @param Condition[] $component the component to be built */
public static function buildAll(array $component): string
{
return implode(' ', $component);
diff --git a/src/Components/CreateDefinition.php b/src/Components/CreateDefinition.php
index e4ff87234..edaee1e7a 100644
--- a/src/Components/CreateDefinition.php
+++ b/src/Components/CreateDefinition.php
@@ -154,7 +154,7 @@ public function __construct(
OptionsArray|null $options = null,
DataType|Key|null $type = null,
bool $isConstraint = false,
- Reference|null $references = null
+ Reference|null $references = null,
) {
$this->name = $name;
$this->options = $options;
@@ -247,7 +247,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
'A symbol name was expected! '
. 'A reserved keyword can not be used '
. 'as a column name without backquotes.',
- $token
+ $token,
);
return $ret;
@@ -340,9 +340,7 @@ public function build(): string
return trim($tmp);
}
- /**
- * @param CreateDefinition[] $component the component to be built
- */
+ /** @param CreateDefinition[] $component the component to be built */
public static function buildAll(array $component): string
{
return "(\n " . implode(",\n ", $component) . "\n)";
diff --git a/src/Components/DataType.php b/src/Components/DataType.php
index 8bda9a434..9968643d0 100644
--- a/src/Components/DataType.php
+++ b/src/Components/DataType.php
@@ -80,7 +80,7 @@ final class DataType implements Component
public function __construct(
string|null $name = null,
array $parameters = [],
- OptionsArray|null $options = null
+ OptionsArray|null $options = null,
) {
$this->name = $name;
$this->parameters = $parameters;
diff --git a/src/Components/Expression.php b/src/Components/Expression.php
index 5325a5da1..8d62a1fc3 100644
--- a/src/Components/Expression.php
+++ b/src/Components/Expression.php
@@ -4,6 +4,7 @@
namespace PhpMyAdmin\SqlParser\Components;
+use AllowDynamicProperties;
use PhpMyAdmin\SqlParser\Component;
use PhpMyAdmin\SqlParser\Context;
use PhpMyAdmin\SqlParser\Exceptions\ParserException;
@@ -21,7 +22,7 @@
* Parses a reference to an expression (column, table or database name, function
* call, mathematical expression, etc.).
*/
-#[\AllowDynamicProperties]
+#[AllowDynamicProperties]
final class Expression implements Component
{
/**
@@ -114,7 +115,7 @@ public function __construct(
string|null $database = null,
string|null $table = null,
string|null $column = null,
- string|null $alias = null
+ string|null $alias = null,
) {
if (($column === null) && ($alias === null)) {
$this->expr = $database; // case 1
@@ -476,9 +477,7 @@ public function build(): string
return $ret;
}
- /**
- * @param Expression[] $component the component to be built
- */
+ /** @param Expression[] $component the component to be built */
public static function buildAll(array $component): string
{
return implode(', ', $component);
diff --git a/src/Components/ExpressionArray.php b/src/Components/ExpressionArray.php
index 0d259cee6..2c24a5017 100644
--- a/src/Components/ExpressionArray.php
+++ b/src/Components/ExpressionArray.php
@@ -124,9 +124,7 @@ public function build(): string
throw new RuntimeException(Translator::gettext('Not implemented yet.'));
}
- /**
- * @param Expression[] $component the component to be built
- */
+ /** @param Expression[] $component the component to be built */
public static function buildAll(array $component): string
{
return implode(', ', $component);
diff --git a/src/Components/GroupKeyword.php b/src/Components/GroupKeyword.php
index 70950bd97..38855df89 100644
--- a/src/Components/GroupKeyword.php
+++ b/src/Components/GroupKeyword.php
@@ -27,9 +27,7 @@ final class GroupKeyword implements Component
*/
public $expr;
- /**
- * @param Expression $expr the expression that we are sorting by
- */
+ /** @param Expression $expr the expression that we are sorting by */
public function __construct(Expression|null $expr = null)
{
$this->expr = $expr;
@@ -115,9 +113,7 @@ public function build(): string
return trim((string) $this->expr);
}
- /**
- * @param GroupKeyword[] $component the component to be built
- */
+ /** @param GroupKeyword[] $component the component to be built */
public static function buildAll(array $component): string
{
return implode(', ', $component);
diff --git a/src/Components/IndexHint.php b/src/Components/IndexHint.php
index c327365a8..ce44248c5 100644
--- a/src/Components/IndexHint.php
+++ b/src/Components/IndexHint.php
@@ -48,7 +48,7 @@ public function __construct(
string|null $type = null,
string|null $indexOrKey = null,
string|null $for = null,
- array $indexes = []
+ array $indexes = [],
) {
$this->type = $type;
$this->indexOrKey = $indexOrKey;
@@ -186,9 +186,7 @@ public function build(): string
return $ret . Expression::buildAll($this->indexes);
}
- /**
- * @param IndexHint[] $component the component to be built
- */
+ /** @param IndexHint[] $component the component to be built */
public static function buildAll(array $component): string
{
return implode(' ', $component);
diff --git a/src/Components/IntoKeyword.php b/src/Components/IntoKeyword.php
index 3772aaaa6..5ecd30b43 100644
--- a/src/Components/IntoKeyword.php
+++ b/src/Components/IntoKeyword.php
@@ -118,7 +118,7 @@ public function __construct(
array|null $columns = null,
array|null $values = null,
OptionsArray|null $fieldsOptions = null,
- bool|null $fieldsKeyword = null
+ bool|null $fieldsKeyword = null,
) {
$this->type = $type;
$this->dest = $dest;
@@ -195,7 +195,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
[
'parseField' => 'table',
'breakOnAlias' => true,
- ]
+ ],
);
} else {
$ret->values = ExpressionArray::parse($parser, $list);
diff --git a/src/Components/JoinKeyword.php b/src/Components/JoinKeyword.php
index 93051046c..b975c90aa 100644
--- a/src/Components/JoinKeyword.php
+++ b/src/Components/JoinKeyword.php
@@ -82,7 +82,7 @@ public function __construct(
string|null $type = null,
Expression|null $expr = null,
array|null $on = null,
- ArrayObj|null $using = null
+ ArrayObj|null $using = null,
) {
$this->type = $type;
$this->expr = $expr;
@@ -206,9 +206,7 @@ public function build(): string
throw new RuntimeException(Translator::gettext('Not implemented yet.'));
}
- /**
- * @param JoinKeyword[] $component the component to be built
- */
+ /** @param JoinKeyword[] $component the component to be built */
public static function buildAll(array $component): string
{
$ret = [];
diff --git a/src/Components/Key.php b/src/Components/Key.php
index 5b5586774..d041bd6ef 100644
--- a/src/Components/Key.php
+++ b/src/Components/Key.php
@@ -108,7 +108,7 @@ public function __construct(
string|null $name = null,
array $columns = [],
string|null $type = null,
- OptionsArray|null $options = null
+ OptionsArray|null $options = null,
) {
$this->name = $name;
$this->columns = $columns;
diff --git a/src/Components/LockExpression.php b/src/Components/LockExpression.php
index 8fba3c34e..3ef6f7c8c 100644
--- a/src/Components/LockExpression.php
+++ b/src/Components/LockExpression.php
@@ -96,9 +96,7 @@ public function build(): string
return $this->table . ' ' . $this->type;
}
- /**
- * @param LockExpression[] $component the component to be built
- */
+ /** @param LockExpression[] $component the component to be built */
public static function buildAll(array $component): string
{
return implode(', ', $component);
diff --git a/src/Components/OptionsArray.php b/src/Components/OptionsArray.php
index c083f08bf..2350b5966 100644
--- a/src/Components/OptionsArray.php
+++ b/src/Components/OptionsArray.php
@@ -134,9 +134,9 @@ public static function parse(Parser $parser, TokensList $list, array $options =
Translator::gettext('This option conflicts with "%1$s".'),
is_array($ret->options[$lastOptionId])
? $ret->options[$lastOptionId]['name']
- : $ret->options[$lastOptionId]
+ : $ret->options[$lastOptionId],
),
- $token
+ $token,
);
$lastOptionId = $lastAssignedId++;
}
@@ -201,7 +201,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
$ret->options[$lastOptionId]['expr'] = Expression::parse(
$parser,
$list,
- empty($lastOption[2]) ? [] : $lastOption[2]
+ empty($lastOption[2]) ? [] : $lastOption[2],
);
if ($ret->options[$lastOptionId]['expr'] !== null) {
$ret->options[$lastOptionId]['value']
@@ -249,9 +249,9 @@ public static function parse(Parser $parser, TokensList $list, array $options =
$parser->error(
sprintf(
'Value/Expression for the option %1$s was expected.',
- $ret->options[$lastOptionId]['name']
+ $ret->options[$lastOptionId]['name'],
),
- $list->tokens[$list->idx - 1]
+ $list->tokens[$list->idx - 1],
);
}
diff --git a/src/Components/OrderKeyword.php b/src/Components/OrderKeyword.php
index d90f062ac..05ad2d413 100644
--- a/src/Components/OrderKeyword.php
+++ b/src/Components/OrderKeyword.php
@@ -120,9 +120,7 @@ public function build(): string
return $this->expr . ' ' . $this->type;
}
- /**
- * @param OrderKeyword[] $component the component to be built
- */
+ /** @param OrderKeyword[] $component the component to be built */
public static function buildAll(array $component): string
{
return implode(', ', $component);
diff --git a/src/Components/ParameterDefinition.php b/src/Components/ParameterDefinition.php
index fcecbcd1a..d1696a52f 100644
--- a/src/Components/ParameterDefinition.php
+++ b/src/Components/ParameterDefinition.php
@@ -147,13 +147,11 @@ public function build(): string
}
return trim(
- $tmp . Context::escape($this->name) . ' ' . $this->type
+ $tmp . Context::escape($this->name) . ' ' . $this->type,
);
}
- /**
- * @param ParameterDefinition[] $component the component to be built
- */
+ /** @param ParameterDefinition[] $component the component to be built */
public static function buildAll(array $component): string
{
return '(' . implode(', ', $component) . ')';
diff --git a/src/Components/PartitionDefinition.php b/src/Components/PartitionDefinition.php
index c59d2366c..be373f25a 100644
--- a/src/Components/PartitionDefinition.php
+++ b/src/Components/PartitionDefinition.php
@@ -193,7 +193,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
[
'parenthesesDelimited' => true,
'breakOnAlias' => true,
- ]
+ ],
);
}
@@ -206,7 +206,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
$ret->subpartitions = ArrayObj::parse(
$parser,
$list,
- ['type' => self::class]
+ ['type' => self::class],
);
++$list->idx;
}
@@ -232,13 +232,11 @@ public function build(): string
'PARTITION ' . $this->name
. (empty($this->type) ? '' : ' VALUES ' . $this->type . ' ' . $this->expr . ' ')
. (! empty($this->options) && ! empty($this->type) ? '' : ' ')
- . $this->options . $subpartitions
+ . $this->options . $subpartitions,
);
}
- /**
- * @param PartitionDefinition[] $component the component to be built
- */
+ /** @param PartitionDefinition[] $component the component to be built */
public static function buildAll(array $component): string
{
return "(\n" . implode(",\n", $component) . "\n)";
diff --git a/src/Components/Reference.php b/src/Components/Reference.php
index 8316dca45..f13573bc1 100644
--- a/src/Components/Reference.php
+++ b/src/Components/Reference.php
@@ -116,7 +116,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
[
'parseField' => 'table',
'breakOnAlias' => true,
- ]
+ ],
);
$state = 1;
} elseif ($state === 1) {
@@ -139,7 +139,7 @@ public function build(): string
return trim(
$this->table
. ' (' . implode(', ', Context::escapeAll($this->columns)) . ') '
- . $this->options
+ . $this->options,
);
}
diff --git a/src/Components/RenameOperation.php b/src/Components/RenameOperation.php
index f9361d35e..c1dace454 100644
--- a/src/Components/RenameOperation.php
+++ b/src/Components/RenameOperation.php
@@ -94,7 +94,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
[
'breakOnAlias' => true,
'parseField' => 'table',
- ]
+ ],
);
if (empty($expr->old)) {
$parser->error('The old name of the table was expected.', $token);
@@ -115,7 +115,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
[
'breakOnAlias' => true,
'parseField' => 'table',
- ]
+ ],
);
if (empty($expr->new)) {
$parser->error('The new name of the table was expected.', $token);
@@ -152,9 +152,7 @@ public function build(): string
return $this->old . ' TO ' . $this->new;
}
- /**
- * @param RenameOperation[] $component the component to be built
- */
+ /** @param RenameOperation[] $component the component to be built */
public static function buildAll(array $component): string
{
return implode(', ', $component);
diff --git a/src/Components/SetOperation.php b/src/Components/SetOperation.php
index 1d09d4085..2d695d936 100644
--- a/src/Components/SetOperation.php
+++ b/src/Components/SetOperation.php
@@ -114,7 +114,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
$tmp = Expression::parse(
$parser,
$list,
- ['breakOnAlias' => true]
+ ['breakOnAlias' => true],
);
if ($tmp === null) {
$parser->error('Missing expression.', $token);
@@ -145,9 +145,7 @@ public function build(): string
return $this->column . ' = ' . $this->value;
}
- /**
- * @param SetOperation[] $component the component to be built
- */
+ /** @param SetOperation[] $component the component to be built */
public static function buildAll(array $component): string
{
return implode(', ', $component);
diff --git a/src/Components/UnionKeyword.php b/src/Components/UnionKeyword.php
index e07192ae3..3829abf45 100644
--- a/src/Components/UnionKeyword.php
+++ b/src/Components/UnionKeyword.php
@@ -36,9 +36,7 @@ public function build(): string
throw new RuntimeException(Translator::gettext('Not implemented yet.'));
}
- /**
- * @param UnionKeyword[][] $component the component to be built
- */
+ /** @param UnionKeyword[][] $component the component to be built */
public static function buildAll(array $component): string
{
$tmp = [];
diff --git a/src/Context.php b/src/Context.php
index 77c51db79..7f5fee4f0 100644
--- a/src/Context.php
+++ b/src/Context.php
@@ -624,9 +624,7 @@ public static function setMode(int|string $mode = self::SQL_MODE_NONE): void
}
}
- /**
- * @psalm-suppress MixedReturnStatement, MixedInferredReturnType Is caused by the LSB of the constants
- */
+ /** @psalm-suppress MixedReturnStatement, MixedInferredReturnType Is caused by the LSB of the constants */
private static function getModeFromString(string $mode): int
{
return match ($mode) {
diff --git a/src/Exceptions/LexerException.php b/src/Exceptions/LexerException.php
index 2b5572829..abb87aa1b 100644
--- a/src/Exceptions/LexerException.php
+++ b/src/Exceptions/LexerException.php
@@ -34,6 +34,7 @@ class LexerException extends Exception
public function __construct(string $msg = '', string $ch = '', int $pos = 0, int $code = 0)
{
parent::__construct($msg, $code);
+
$this->ch = $ch;
$this->pos = $pos;
}
diff --git a/src/Exceptions/ParserException.php b/src/Exceptions/ParserException.php
index be117065b..0341f8f8e 100644
--- a/src/Exceptions/ParserException.php
+++ b/src/Exceptions/ParserException.php
@@ -27,6 +27,7 @@ class ParserException extends Exception
public function __construct(string $msg = '', Token|null $token = null, int $code = 0)
{
parent::__construct($msg, $code);
+
$this->token = $token;
}
}
diff --git a/src/Lexer.php b/src/Lexer.php
index 9af3a208e..a4fe42b4c 100644
--- a/src/Lexer.php
+++ b/src/Lexer.php
@@ -389,7 +389,7 @@ public function error(string $msg, string $str = '', int $pos = 0, int $code = 0
Translator::gettext($msg),
$str,
$pos,
- $code
+ $code,
);
if ($this->strict) {
@@ -906,10 +906,10 @@ public function parseString(string $quote = ''): Token|null
$this->error(
sprintf(
Translator::gettext('Ending quote %1$s was expected.'),
- $quote
+ $quote,
),
'',
- $this->last
+ $this->last,
);
} else {
$token .= $this->str[$this->last];
diff --git a/src/Parser.php b/src/Parser.php
index c716bf0f3..f66beb44b 100644
--- a/src/Parser.php
+++ b/src/Parser.php
@@ -639,7 +639,7 @@ public function error(string $msg, Token|null $token = null, int $code = 0): voi
$error = new ParserException(
Translator::gettext($msg),
$token,
- $code
+ $code,
);
if ($this->strict) {
diff --git a/src/Statement.php b/src/Statement.php
index 30eb1b970..77a906b06 100644
--- a/src/Statement.php
+++ b/src/Statement.php
@@ -4,6 +4,7 @@
namespace PhpMyAdmin\SqlParser;
+use AllowDynamicProperties;
use PhpMyAdmin\SqlParser\Components\OptionsArray;
use Stringable;
@@ -21,7 +22,7 @@
*
* Abstract statement definition.
*/
-#[\AllowDynamicProperties]
+#[AllowDynamicProperties]
abstract class Statement implements Stringable
{
/**
@@ -339,7 +340,7 @@ public function parse(Parser $parser, TokensList $list): void
// delimiter was found between them.
$parser->error(
'A new statement was found, but no delimiter between it and the previous one.',
- $token
+ $token,
);
break;
}
@@ -359,7 +360,7 @@ public function parse(Parser $parser, TokensList $list): void
$this->groupOptions = OptionsArray::parse(
$parser,
$list,
- Statements\SelectStatement::STATEMENT_GROUP_OPTIONS
+ Statements\SelectStatement::STATEMENT_GROUP_OPTIONS,
);
} elseif (
$this instanceof Statements\SelectStatement
@@ -370,7 +371,7 @@ public function parse(Parser $parser, TokensList $list): void
$this->endOptions = OptionsArray::parse(
$parser,
$list,
- Statements\SelectStatement::STATEMENT_END_OPTIONS
+ Statements\SelectStatement::STATEMENT_END_OPTIONS,
);
} elseif (
$this instanceof Statements\SetStatement
@@ -381,7 +382,7 @@ public function parse(Parser $parser, TokensList $list): void
$this->endOptions = OptionsArray::parse(
$parser,
$list,
- Statements\SetStatement::STATEMENT_END_OPTIONS
+ Statements\SetStatement::STATEMENT_END_OPTIONS,
);
} else {
// There is no parser for this keyword and isn't the beginning
diff --git a/src/Statements/AlterStatement.php b/src/Statements/AlterStatement.php
index f2d27593a..814b0d52b 100644
--- a/src/Statements/AlterStatement.php
+++ b/src/Statements/AlterStatement.php
@@ -84,7 +84,7 @@ public function parse(Parser $parser, TokensList $list): void
[
'parseField' => 'table',
'breakOnAlias' => true,
- ]
+ ],
);
++$list->idx; // Skipping field.
@@ -151,7 +151,7 @@ public function build(): string
return trim(
'ALTER ' . $this->options->build()
. ' ' . $this->table->build()
- . ' ' . implode(', ', $tmp)
+ . ' ' . implode(', ', $tmp),
);
}
}
diff --git a/src/Statements/CreateStatement.php b/src/Statements/CreateStatement.php
index 2300331c8..ff40e15f9 100644
--- a/src/Statements/CreateStatement.php
+++ b/src/Statements/CreateStatement.php
@@ -532,7 +532,7 @@ public function parse(Parser $parser, TokensList $list): void
[
'parseField' => $fieldName,
'breakOnAlias' => true,
- ]
+ ],
);
if ($this->name === null) {
@@ -581,7 +581,7 @@ public function parse(Parser $parser, TokensList $list): void
[
'parseField' => 'table',
'breakOnAlias' => true,
- ]
+ ],
);
// The 'LIKE' keyword was found, but no table_name was found next to it
if ($this->like === null) {
@@ -680,7 +680,7 @@ public function parse(Parser $parser, TokensList $list): void
$this->partitions = ArrayObj::parse(
$parser,
$list,
- ['type' => PartitionDefinition::class]
+ ['type' => PartitionDefinition::class],
);
}
@@ -766,7 +766,7 @@ public function parse(Parser $parser, TokensList $list): void
[
'parseField' => 'table',
'breakOnAlias' => true,
- ]
+ ],
);
++$list->idx;
diff --git a/src/Statements/InsertStatement.php b/src/Statements/InsertStatement.php
index 72c481264..6c7e83b88 100644
--- a/src/Statements/InsertStatement.php
+++ b/src/Statements/InsertStatement.php
@@ -190,7 +190,7 @@ public function parse(Parser $parser, TokensList $list): void
$this->into = IntoKeyword::parse(
$parser,
$list,
- ['fromInsert' => true]
+ ['fromInsert' => true],
);
$state = 1;
diff --git a/src/Statements/LoadStatement.php b/src/Statements/LoadStatement.php
index 7ae97fd7c..61f6adea6 100644
--- a/src/Statements/LoadStatement.php
+++ b/src/Statements/LoadStatement.php
@@ -265,7 +265,7 @@ public function parse(Parser $parser, TokensList $list): void
$this->fileName = Expression::parse(
$parser,
$list,
- ['parseField' => 'file']
+ ['parseField' => 'file'],
);
$state = 1;
} elseif ($state === 1) {
diff --git a/src/Statements/MaintenanceStatement.php b/src/Statements/MaintenanceStatement.php
index 3748670ba..14009350c 100644
--- a/src/Statements/MaintenanceStatement.php
+++ b/src/Statements/MaintenanceStatement.php
@@ -48,8 +48,8 @@ public function after(Parser $parser, TokensList $list, Token $token): void
OptionsArray::parse(
$parser,
$list,
- static::$statementOptions
- )
+ static::$statementOptions,
+ ),
);
}
}
diff --git a/src/Statements/ReplaceStatement.php b/src/Statements/ReplaceStatement.php
index 89f79fc5b..3de8afee0 100644
--- a/src/Statements/ReplaceStatement.php
+++ b/src/Statements/ReplaceStatement.php
@@ -149,7 +149,7 @@ public function parse(Parser $parser, TokensList $list): void
$this->into = IntoKeyword::parse(
$parser,
$list,
- ['fromReplace' => true]
+ ['fromReplace' => true],
);
$state = 1;
diff --git a/src/Statements/WithStatement.php b/src/Statements/WithStatement.php
index a911bbb67..1892c24ca 100644
--- a/src/Statements/WithStatement.php
+++ b/src/Statements/WithStatement.php
@@ -324,7 +324,7 @@ private function getSubTokenList(TokensList $list): ParserException|TokensList
return new ParserException(
Translator::gettext('A closing bracket was expected.'),
- $token
+ $token,
);
}
diff --git a/src/Token.php b/src/Token.php
index 9db9186b1..2d6031f82 100644
--- a/src/Token.php
+++ b/src/Token.php
@@ -190,7 +190,7 @@ public function extract(): mixed
$str,
! empty($str[1]) && ($str[1] === '@') ? 2 : 1,
mb_strlen($str),
- 'UTF-8'
+ 'UTF-8',
);
}
@@ -226,7 +226,7 @@ public function getInlineToken(): string
'\n',
'\t',
],
- $this->token
+ $this->token,
);
}
}
diff --git a/src/TokensList.php b/src/TokensList.php
index d4e769a53..dd90bb991 100644
--- a/src/TokensList.php
+++ b/src/TokensList.php
@@ -33,9 +33,7 @@ class TokensList implements ArrayAccess
*/
public $idx = 0;
- /**
- * @param Token[] $tokens The array of tokens.
- */
+ /** @param Token[] $tokens The array of tokens. */
public function __construct(public array $tokens = [])
{
$this->count = count($tokens);
diff --git a/src/Tools/ContextGenerator.php b/src/Tools/ContextGenerator.php
index beaa18d08..f3bbba53d 100644
--- a/src/Tools/ContextGenerator.php
+++ b/src/Tools/ContextGenerator.php
@@ -370,10 +370,10 @@ public static function build(string $input, string $output): void
$directory . '_common.txt',
$directory . '_functions' . $file,
$directory . $file,
- ]
+ ],
),
- ]
- )
+ ],
+ ),
);
}
diff --git a/src/Tools/CustomJsonSerializer.php b/src/Tools/CustomJsonSerializer.php
index 9fad80e6a..d05f0f0bc 100644
--- a/src/Tools/CustomJsonSerializer.php
+++ b/src/Tools/CustomJsonSerializer.php
@@ -43,7 +43,7 @@ protected function extractObjectData($value, $ref, $properties): array
$propRef = $ref->getProperty($property);
$propRef->setAccessible(true);
$data[$property] = $propRef->getValue($value);
- } catch (ReflectionException $e) {
+ } catch (ReflectionException) {
$data[$property] = $value->$property;
}
}
diff --git a/src/Tools/TestGenerator.php b/src/Tools/TestGenerator.php
index c26594ede..b6dc65c4e 100644
--- a/src/Tools/TestGenerator.php
+++ b/src/Tools/TestGenerator.php
@@ -138,7 +138,7 @@ public static function build(
string $input,
string $output,
string|null $debug = null,
- bool $ansi = false
+ bool $ansi = false,
): void {
// Support query types: `lexer` / `parser`.
if (! in_array($type, ['lexer', 'parser'])) {
@@ -182,7 +182,7 @@ public static function build(
$encoded = (string) json_encode(
json_decode($encoded),
- JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_PRESERVE_ZERO_FRACTION | JSON_UNESCAPED_SLASHES
+ JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_PRESERVE_ZERO_FRACTION | JSON_UNESCAPED_SLASHES,
);
// Remove the project path from .out file, it changes for each dev
@@ -249,7 +249,7 @@ public static function buildAll(string $input, string $output, mixed $debug = nu
$inputFile,
$outputFile,
$debugFile,
- str_contains($inputFile, 'ansi')
+ str_contains($inputFile, 'ansi'),
);
} else {
echo sprintf("Test for %s already built!\n", $inputFile);
diff --git a/src/Translator.php b/src/Translator.php
index e92c2d8fa..ecb801f06 100644
--- a/src/Translator.php
+++ b/src/Translator.php
@@ -38,7 +38,7 @@ public static function load(): void
// Set locale
self::$loader->setlocale(
- self::$loader->detectlocale()
+ self::$loader->detectlocale(),
);
// Set default text domain
diff --git a/src/UtfString.php b/src/UtfString.php
index d323a4ca2..843416223 100644
--- a/src/UtfString.php
+++ b/src/UtfString.php
@@ -71,9 +71,7 @@ class UtfString implements ArrayAccess, Stringable
*/
public $charLen = 0;
- /**
- * @param string $str the string
- */
+ /** @param string $str the string */
public function __construct(string $str)
{
$this->str = $str;
diff --git a/src/Utils/BufferedQuery.php b/src/Utils/BufferedQuery.php
index a9b7a3b40..93396f614 100644
--- a/src/Utils/BufferedQuery.php
+++ b/src/Utils/BufferedQuery.php
@@ -96,7 +96,7 @@ public function __construct(string $query = '', array $options = [])
// Whether a delimiter should be added at the end of the statement.
'add_delimiter' => false,
],
- $options
+ $options,
);
$this->query = $query;
@@ -330,7 +330,7 @@ public function extract(bool $end = false): string|false
// Appending the `DELIMITER` statement that was just
// found to the current statement.
$ret = trim(
- $this->current . ' ' . substr($this->query, $iBak, $i - $iBak)
+ $this->current . ' ' . substr($this->query, $iBak, $i - $iBak),
);
}
diff --git a/src/Utils/CLI.php b/src/Utils/CLI.php
index a03b518ed..dcff227c6 100644
--- a/src/Utils/CLI.php
+++ b/src/Utils/CLI.php
@@ -60,9 +60,7 @@ public function getopt(string $opt, array $long): array|false
return getopt($opt, $long);
}
- /**
- * @return string[]|false[]|false
- */
+ /** @return string[]|false[]|false */
public function parseHighlight(): array|false
{
$longopts = [
@@ -118,7 +116,7 @@ public function runHighlight(): int
if (isset($params['q'])) {
echo Formatter::format(
$params['q'],
- ['type' => $params['f']]
+ ['type' => $params['f']],
);
echo "\n";
@@ -137,9 +135,7 @@ public function usageLint(): void
echo " cat file.sql | lint-query\n";
}
- /**
- * @return string[]|false[]|false
- */
+ /** @return string[]|false[]|false */
public function parseLint(): array|false
{
$longopts = [
@@ -214,9 +210,7 @@ public function usageTokenize(): void
echo " cat file.sql | tokenize-query\n";
}
- /**
- * @return string[]|false[]|false
- */
+ /** @return string[]|false[]|false */
public function parseTokenize(): array|false
{
$longopts = [
diff --git a/src/Utils/Error.php b/src/Utils/Error.php
index 8b4027e1a..e945b3c65 100644
--- a/src/Utils/Error.php
+++ b/src/Utils/Error.php
@@ -76,7 +76,7 @@ public static function get(array $objs): array
*/
public static function format(
array $errors,
- string $format = '#%1$d: %2$s (near "%4$s" at position %5$d)'
+ string $format = '#%1$d: %2$s (near "%4$s" at position %5$d)',
): array {
$ret = [];
@@ -88,7 +88,7 @@ public static function format(
$err[0],
$err[1],
htmlspecialchars((string) $err[2]),
- $err[3]
+ $err[3],
);
}
diff --git a/src/Utils/Formatter.php b/src/Utils/Formatter.php
index 4f4089a94..76988fbcf 100644
--- a/src/Utils/Formatter.php
+++ b/src/Utils/Formatter.php
@@ -78,9 +78,7 @@ class Formatter
'VALUES' => true,
];
- /**
- * @param array>> $options the formatting options
- */
+ /** @param array>> $options the formatting options */
public function __construct(array $options = [])
{
$this->options = $this->getMergedOptions($options);
@@ -97,7 +95,7 @@ protected function getMergedOptions(array $options): array
{
$options = array_merge(
$this->getDefaultOptions(),
- $options
+ $options,
);
if (isset($options['formats'])) {
@@ -627,7 +625,7 @@ public function escapeConsole(string $string): string
'\x1E',
'\x1F',
],
- $string
+ $string,
);
}
diff --git a/src/Utils/Query.php b/src/Utils/Query.php
index 1de6ca200..72f757213 100644
--- a/src/Utils/Query.php
+++ b/src/Utils/Query.php
@@ -616,7 +616,7 @@ public static function getClause(
TokensList $list,
string $clause,
int|string $type = 0,
- bool $skipFirst = true
+ bool $skipFirst = true,
): string {
/**
* The index of the current clause.
@@ -748,7 +748,7 @@ public static function replaceClause(
TokensList $list,
string $old,
string|null $new = null,
- bool $onlyType = false
+ bool $onlyType = false,
): string {
// TODO: Update the tokens list and the statement.
diff --git a/tests/Builder/AlterStatementTest.php b/tests/Builder/AlterStatementTest.php
index 79472c9b8..345896a5a 100644
--- a/tests/Builder/AlterStatementTest.php
+++ b/tests/Builder/AlterStatementTest.php
@@ -88,7 +88,7 @@ public function testBuilderPartitions(): void
"ALTER TABLE t1 ADD PARTITION (\n" .
"PARTITION p3 VALUES LESS THAN (2002)\n" .
')',
- $stmt->build()
+ $stmt->build(),
);
$parser = new Parser('ALTER TABLE p PARTITION BY LINEAR KEY ALGORITHM=2 (id) PARTITIONS 32;');
@@ -96,7 +96,7 @@ public function testBuilderPartitions(): void
$this->assertEquals(
'ALTER TABLE p PARTITION BY LINEAR KEY ALGORITHM=2 (id) PARTITIONS 32',
- $stmt->build()
+ $stmt->build(),
);
$parser = new Parser('ALTER TABLE t1 DROP PARTITION p0, p1;');
@@ -104,7 +104,7 @@ public function testBuilderPartitions(): void
$this->assertEquals(
'ALTER TABLE t1 DROP PARTITION p0, p1',
- $stmt->build()
+ $stmt->build(),
);
$parser = new Parser(
@@ -123,7 +123,7 @@ public function testBuilderPartitions(): void
. ' PARTITION p11 VALUES LESS THAN (12),' . "\n"
. ' PARTITION p12 VALUES LESS THAN (13),' . "\n"
. ' PARTITION pmaxval VALUES LESS THAN MAXVALUE' . "\n"
- . ');'
+ . ');',
);
$stmt = $parser->statements[0];
@@ -143,7 +143,7 @@ public function testBuilderPartitions(): void
. 'PARTITION p12 VALUES LESS THAN (13),' . "\n"
. 'PARTITION pmaxval VALUES LESS THAN MAXVALUE' . "\n"
. ')',
- $stmt->build()
+ $stmt->build(),
);
}
@@ -155,9 +155,7 @@ public function testBuilderEventWithDefiner(): void
$this->assertEquals($query, $stmt->build());
}
- /**
- * @return Generator
- */
+ /** @return Generator */
public static function provideBuilderForRenameColumn(): Generator
{
$query = 'ALTER TABLE myTable RENAME COLUMN a TO b';
diff --git a/tests/Builder/CreateStatementTest.php b/tests/Builder/CreateStatementTest.php
index e237f1d13..d3b40a0ce 100644
--- a/tests/Builder/CreateStatementTest.php
+++ b/tests/Builder/CreateStatementTest.php
@@ -26,7 +26,7 @@ public function testBuilder(): void
$stmt = $parser->statements[0];
$this->assertEquals(
'CREATE USER "jeffrey"@"localhost" IDENTIFIED BY "mypass"',
- $stmt->build()
+ $stmt->build(),
);
}
@@ -35,14 +35,14 @@ public function testBuilderDatabase(): void
// CREATE DATABASE ...
$parser = new Parser(
'CREATE DATABASE `mydb` ' .
- 'DEFAULT CHARACTER SET = utf8 DEFAULT COLLATE = utf8_general_ci'
+ 'DEFAULT CHARACTER SET = utf8 DEFAULT COLLATE = utf8_general_ci',
);
$stmt = $parser->statements[0];
$this->assertEquals(
'CREATE DATABASE `mydb` ' .
'DEFAULT CHARACTER SET=utf8 DEFAULT COLLATE=utf8_general_ci',
- $stmt->build()
+ $stmt->build(),
);
// CREATE SCHEMA ...
@@ -52,7 +52,7 @@ public function testBuilderDatabase(): void
$this->assertEquals(
'CREATE SCHEMA `mydb` ' .
'DEFAULT CHARACTER SET=utf8 DEFAULT COLLATE=utf8_general_ci',
- $stmt->build()
+ $stmt->build(),
);
}
@@ -61,7 +61,7 @@ public function testBuilderDefaultInt(): void
$parser = new Parser(
'CREATE TABLE IF NOT EXISTS t1 (' .
" c1 int(11) NOT NULL DEFAULT '0' COMMENT 'xxx'" .
- ') ENGINE=MyISAM'
+ ') ENGINE=MyISAM',
);
$stmt = $parser->statements[0];
@@ -69,7 +69,7 @@ public function testBuilderDefaultInt(): void
"CREATE TABLE IF NOT EXISTS t1 (\n" .
" `c1` int(11) NOT NULL DEFAULT '0' COMMENT 'xxx'\n" .
') ENGINE=MyISAM',
- $stmt->build()
+ $stmt->build(),
);
}
@@ -80,7 +80,7 @@ public function testBuilderWithComments(): void
$this->assertEquals(
// TODO: fix with https://github.com/phpmyadmin/sql-parser/issues/256
"CREATE TABLE tab1 (\n `col1` timestamp DEFAULT NULL\n) ",
- $stmt->build()
+ $stmt->build(),
);
}
@@ -90,7 +90,7 @@ public function testBuilderCompressed(): void
$stmt = $parser->statements[0];
$this->assertEquals(
"CREATE TABLE users (\n `user_id` int\n) PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=9",
- $stmt->build()
+ $stmt->build(),
);
}
@@ -99,7 +99,7 @@ public function testBuilderCollate(): void
$parser = new Parser(
'CREATE TABLE IF NOT EXISTS t1 (' .
" c1 varchar(11) NOT NULL DEFAULT '0' COLLATE 'utf8_czech_ci' COMMENT 'xxx'" .
- ') ENGINE=MyISAM'
+ ') ENGINE=MyISAM',
);
$stmt = $parser->statements[0];
@@ -107,7 +107,7 @@ public function testBuilderCollate(): void
"CREATE TABLE IF NOT EXISTS t1 (\n" .
" `c1` varchar(11) NOT NULL DEFAULT '0' COLLATE 'utf8_czech_ci' COMMENT 'xxx'\n" .
') ENGINE=MyISAM',
- $stmt->build()
+ $stmt->build(),
);
}
@@ -117,7 +117,7 @@ public function testBuilderDefaultComment(): void
'CREATE TABLE `wp_audio` (' .
" `somedata` int(11) DEFAULT NULL COMMENT 'ma data', " .
" `someinfo` int(11) DEFAULT NULL COMMENT 'ma info' " .
- ' )'
+ ' )',
);
$stmt = $parser->statements[0];
@@ -126,7 +126,7 @@ public function testBuilderDefaultComment(): void
" `somedata` int(11) DEFAULT NULL COMMENT 'ma data',\n" .
" `someinfo` int(11) DEFAULT NULL COMMENT 'ma info'\n" .
') ',
- $stmt->build()
+ $stmt->build(),
);
}
@@ -141,12 +141,12 @@ public function testBuilderTable(): void
new CreateDefinition(
'id',
new OptionsArray(['NOT NULL', 'AUTO_INCREMENT']),
- new DataType('INT', [11], new OptionsArray(['UNSIGNED']))
+ new DataType('INT', [11], new OptionsArray(['UNSIGNED'])),
),
new CreateDefinition(
'',
null,
- new Key('', [['name' => 'id']], 'PRIMARY KEY')
+ new Key('', [['name' => 'id']], 'PRIMARY KEY'),
),
];
@@ -155,7 +155,7 @@ public function testBuilderTable(): void
" `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,\n" .
" PRIMARY KEY (`id`)\n" .
') ',
- $stmt->build()
+ $stmt->build(),
);
/* Assertion 2 */
@@ -193,7 +193,7 @@ public function testBuilderTable(): void
$parser = new Parser(
'CREATE table table_name WITH' .
' cte (col1) AS ( SELECT 1 UNION ALL SELECT 2 )' .
- ' SELECT col1 FROM cte'
+ ' SELECT col1 FROM cte',
);
$stmt = $parser->statements[0];
@@ -201,7 +201,7 @@ public function testBuilderTable(): void
'CREATE TABLE table_name WITH' .
' cte(col1) AS (SELECT 1 UNION ALL SELECT 2)' .
' SELECT col1 FROM cte',
- $stmt->build()
+ $stmt->build(),
);
}
@@ -252,9 +252,7 @@ public function testBuilderPartitions(): void
$this->assertEquals($query, $parser->statements[0]->build());
}
- /**
- * @return string[][]
- */
+ /** @return string[][] */
public static function partitionQueriesProvider(): array
{
return [
@@ -316,7 +314,7 @@ public function testBuilderView(): void
$parser = new Parser(
'CREATE OR REPLACE VIEW xviewmytable AS SELECT mytable.id '
. 'AS id, mytable.personid AS personid FROM mytable '
- . 'WHERE (mytable.birth > \'1990-01-19\') GROUP BY mytable.personid ;'
+ . 'WHERE (mytable.birth > \'1990-01-19\') GROUP BY mytable.personid ;',
);
$stmt = $parser->statements[0];
@@ -324,50 +322,50 @@ public function testBuilderView(): void
'CREATE OR REPLACE VIEW xviewmytable AS SELECT mytable.id '
. 'AS `id`, mytable.personid AS `personid` FROM mytable '
. 'WHERE (mytable.birth > \'1990-01-19\') GROUP BY mytable.personid ',
- $stmt->build()
+ $stmt->build(),
);
$parser = new Parser(
'CREATE VIEW myView (vid, vfirstname) AS ' .
- 'SELECT id, first_name FROM employee WHERE id = 1'
+ 'SELECT id, first_name FROM employee WHERE id = 1',
);
$stmt = $parser->statements[0];
$this->assertEquals(
'CREATE VIEW myView (vid, vfirstname) AS ' .
'SELECT id, first_name FROM employee WHERE id = 1 ',
- $stmt->build()
+ $stmt->build(),
);
$parser = new Parser(
'CREATE OR REPLACE VIEW myView (vid, vfirstname) AS ' .
- 'SELECT id, first_name FROM employee WHERE id = 1'
+ 'SELECT id, first_name FROM employee WHERE id = 1',
);
$stmt = $parser->statements[0];
$this->assertEquals(
'CREATE OR REPLACE VIEW myView (vid, vfirstname) AS ' .
'SELECT id, first_name FROM employee WHERE id = 1 ',
- $stmt->build()
+ $stmt->build(),
);
// Assert the builder can build wrong syntax select expressions
$parser = new Parser(
'CREATE OR REPLACE VIEW myView (vid, vfirstname) AS ' .
- 'SELECT id, first_name, FROMzz employee WHERE id = 1'
+ 'SELECT id, first_name, FROMzz employee WHERE id = 1',
);
$stmt = $parser->statements[0];
$this->assertEquals(
'CREATE OR REPLACE VIEW myView (vid, vfirstname) AS ' .
'SELECT id, first_name, FROMzz employee WHERE id = 1 ',
- $stmt->build()
+ $stmt->build(),
);
$parser = new Parser(
'CREATE OR REPLACE VIEW myView (vid, vfirstname) AS ' .
'SELECT id, first_name, FROMzz employee WHERE id = 1 ' .
'UNION ' .
- 'SELECT id, first_name, FROMzz employee WHERE id = 2 '
+ 'SELECT id, first_name, FROMzz employee WHERE id = 2 ',
);
$stmt = $parser->statements[0];
@@ -376,7 +374,7 @@ public function testBuilderView(): void
'SELECT id, first_name, FROMzz employee WHERE id = 1 ' .
'UNION ' .
'SELECT id, first_name, FROMzz employee WHERE id = 2 ',
- $stmt->build()
+ $stmt->build(),
);
$parser = new Parser('CREATE VIEW `view_programlevelpartner` AS SELECT `p`.`country_id`'
@@ -385,7 +383,7 @@ public function testBuilderView(): void
$this->assertEquals(
'CREATE VIEW `view_programlevelpartner` AS SELECT `p`.`country_id`'
. ' AS `country_id` FROM `program_level_partner` AS `p` ORDER BY `p`.`id` ASC ',
- $stmt->build()
+ $stmt->build(),
);
$parser = new Parser('CREATE VIEW `view_zg_bycountry` AS '
@@ -394,7 +392,7 @@ public function testBuilderView(): void
$this->assertEquals(
'CREATE VIEW `view_zg_bycountry` AS '
. 'SELECT `d`.`zg_id` FROM `view_zg_value` AS `d` GROUP BY `d`.`ind_id` ',
- $stmt->build()
+ $stmt->build(),
);
$parser = new Parser('CREATE view view_name AS WITH aa(col1)'
@@ -403,7 +401,7 @@ public function testBuilderView(): void
$this->assertEquals(
'CREATE view view_name AS WITH aa(col1)'
. ' AS (SELECT 1 UNION ALL SELECT 2) SELECT col1 FROM cte AS `d` ',
- $stmt->build()
+ $stmt->build(),
);
}
@@ -419,7 +417,7 @@ public function testBuilderViewComplex(): void
. "\n"
. 'SELECT cte.*' . "\n"
. 'FROM cte' . "\n"
- . 'CROSS JOIN gis_all;'
+ . 'CROSS JOIN gis_all;',
);
$stmt = $parser->statements[0];
@@ -432,7 +430,7 @@ public function testBuilderViewComplex(): void
. 'SELECT cte.* '
. 'FROM cte '
. 'CROSS JOIN gis_all ',
- $stmt->build()
+ $stmt->build(),
);
$parser = new Parser(
'CREATE VIEW withclause2 AS' . "\n"
@@ -447,7 +445,7 @@ public function testBuilderViewComplex(): void
. "\n"
. 'SELECT cte.*,cte2.*' . "\n"
. 'FROM cte,cte2' . "\n"
- . 'CROSS JOIN gis_all;'
+ . 'CROSS JOIN gis_all;',
);
$stmt = $parser->statements[0];
@@ -463,7 +461,7 @@ public function testBuilderViewComplex(): void
. ' SELECT cte.*, cte2.* '
. 'FROM cte, cte2'
. ' CROSS JOIN gis_all ',
- $stmt->build()
+ $stmt->build(),
);
}
@@ -472,7 +470,7 @@ public function testBuilderCreateProcedure(): void
$parser = new Parser(
'CREATE DEFINER=`root`@`%`'
. ' PROCEDURE `test2`(IN `_var` INT) DETERMINISTIC'
- . ' MODIFIES SQL DATA SELECT _var'
+ . ' MODIFIES SQL DATA SELECT _var',
);
/** @var CreateStatement $stmt */
@@ -482,13 +480,13 @@ public function testBuilderCreateProcedure(): void
'CREATE DEFINER=`root`@`%`'
. ' PROCEDURE `test2` (IN `_var` INT) DETERMINISTIC'
. ' MODIFIES SQL DATA SELECT _var',
- $stmt->build()
+ $stmt->build(),
);
$parser = new Parser(
'CREATE DEFINER=`root`@`%`'
. ' PROCEDURE `test2`(IN `_var` INT) NOT DETERMINISTIC NO SQL'
- . ' SQL SECURITY INVOKER NO SQL SQL SECURITY INVOKER SELECT _var'
+ . ' SQL SECURITY INVOKER NO SQL SQL SECURITY INVOKER SELECT _var',
);
/** @var CreateStatement $stmt */
@@ -498,35 +496,35 @@ public function testBuilderCreateProcedure(): void
'CREATE DEFINER=`root`@`%`'
. ' PROCEDURE `test2` (IN `_var` INT) NOT DETERMINISTIC NO SQL'
. ' SQL SECURITY INVOKER NO SQL SQL SECURITY INVOKER SELECT _var',
- $stmt->build()
+ $stmt->build(),
);
$this->assertFalse($stmt->entityOptions->isEmpty());
$this->assertFalse($stmt->options->isEmpty());
$this->assertSame(
'DEFINER=`root`@`%` PROCEDURE',
- $stmt->options->__toString()
+ $stmt->options->__toString(),
);
$this->assertSame(
'`test2`',
- $stmt->name->__toString()
+ $stmt->name->__toString(),
);
$this->assertNotNull($stmt->parameters);
$this->assertSame(
'(IN `_var` INT)',
- ParameterDefinition::buildAll($stmt->parameters)
+ ParameterDefinition::buildAll($stmt->parameters),
);
$this->assertSame(
'NOT DETERMINISTIC NO SQL SQL SECURITY INVOKER NO SQL SQL SECURITY INVOKER',
- $stmt->entityOptions->__toString()
+ $stmt->entityOptions->__toString(),
);
$this->assertSame(
'SELECT _var',
- TokensList::buildFromArray($stmt->body)
+ TokensList::buildFromArray($stmt->body),
);
}
@@ -563,7 +561,7 @@ public function testBuilderCreateFunction(): void
. ' ELSE' . "\n"
. ' RETURN TRUE;' . "\n"
. ' END IF;' . "\n"
- . 'END'
+ . 'END',
);
/** @var CreateStatement $stmt */
@@ -600,7 +598,7 @@ public function testBuilderCreateFunction(): void
. ' RETURN TRUE;' . "\n"
. ' END IF;' . "\n"
. 'END',
- $stmt->build()
+ $stmt->build(),
);
$this->assertFalse($stmt->entityOptions->isEmpty());
@@ -608,23 +606,23 @@ public function testBuilderCreateFunction(): void
$this->assertSame(
'DEFINER=`root`@`localhost` FUNCTION',
- $stmt->options->__toString()
+ $stmt->options->__toString(),
);
$this->assertSame(
'`inventory_in_stock`',
- $stmt->name->__toString()
+ $stmt->name->__toString(),
);
$this->assertNotNull($stmt->parameters);
$this->assertSame(
'(`p_inventory_id` INT)',
- ParameterDefinition::buildAll($stmt->parameters)
+ ParameterDefinition::buildAll($stmt->parameters),
);
$this->assertSame(
'READS SQL DATA COMMENT \'My best function written by a friend\'\'s friend\'',
- $stmt->entityOptions->__toString()
+ $stmt->entityOptions->__toString(),
);
$this->assertSame(
@@ -654,7 +652,7 @@ public function testBuilderCreateFunction(): void
. ' RETURN TRUE;' . "\n"
. ' END IF;' . "\n"
. 'END',
- TokensList::buildFromArray($stmt->body)
+ TokensList::buildFromArray($stmt->body),
);
}
@@ -685,7 +683,7 @@ public function testBuilderTrigger(): void
$this->assertEquals(
'CREATE TRIGGER ins_sum BEFORE INSERT ON account ' .
'FOR EACH ROW SET @sum = @sum + NEW.amount',
- $stmt->build()
+ $stmt->build(),
);
}
@@ -698,7 +696,7 @@ public function testBuilderRoutine(): void
'DECLARE name VARCHAR DEFAULT ""; ' .
'SELECT name INTO name FROM employees WHERE id = i; ' .
'RETURN name; ' .
- 'END'
+ 'END',
);
$stmt = $parser->statements[0];
@@ -709,7 +707,7 @@ public function testBuilderRoutine(): void
'SELECT name INTO name FROM employees WHERE id = i; ' .
'RETURN name; ' .
'END',
- $stmt->build()
+ $stmt->build(),
);
}
@@ -718,7 +716,7 @@ public function testBuildSelect(): void
$parser = new Parser('CREATE TABLE new_tbl SELECT * FROM orig_tbl');
$this->assertEquals(
'CREATE TABLE new_tbl SELECT * FROM orig_tbl',
- $parser->statements[0]->build()
+ $parser->statements[0]->build(),
);
}
@@ -735,7 +733,7 @@ public function testBuildCreateTableSortedIndex(): void
KEY `entries__ug2` (`fk_ug_id` ASC),
KEY `33` (`id` ASC, `fk_ug_id` DESC)
) /*!50100 TABLESPACE `innodb_system` */ ENGINE=InnoDB AUTO_INCREMENT=4465 DEFAULT CHARSET=utf8
-SQL
+SQL,
);
/** @var CreateStatement $stmt */
@@ -756,14 +754,14 @@ public function testBuildCreateTableSortedIndex(): void
$this->assertIsArray($stmt->fields);
$this->assertEquals(
$tableBody,
- CreateDefinition::buildAll($stmt->fields)
+ CreateDefinition::buildAll($stmt->fields),
);
$this->assertEquals(
'CREATE TABLE `entries` '
. $tableBody
. ' ENGINE=InnoDB AUTO_INCREMENT=4465 DEFAULT CHARSET=utf8 TABLESPACE `innodb_system`',
- $stmt->build()
+ $stmt->build(),
);
}
@@ -812,7 +810,7 @@ public function testBuildCreateTableComplexIndexes(): void
KEY `updated_tz_ind_two_indexes` ((convert_tz(`cache_updated`,_utf8mb4'GMT',_utf8mb4'GB')), (convert_tz(`cache_updated`,_utf8mb4'GMT',_utf8mb4'FR'))) COMMENT 'bar\'s',
KEY `updated_tz_ind` ((convert_tz(`cache_updated`,_utf8mb4'GMT',_utf8mb4'GB')))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-SQL
+SQL,
);
// phpcs:enable
@@ -856,14 +854,14 @@ public function testBuildCreateTableComplexIndexes(): void
$this->assertIsArray($stmt->fields);
$this->assertEquals(
$tableBody,
- CreateDefinition::buildAll($stmt->fields)
+ CreateDefinition::buildAll($stmt->fields),
);
$this->assertEquals(
'CREATE TABLE `page_rebuild_control` '
. $tableBody
. ' ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci',
- $stmt->build()
+ $stmt->build(),
);
}
}
diff --git a/tests/Builder/ExplainStatementTest.php b/tests/Builder/ExplainStatementTest.php
index 7fc0422d3..58abdc742 100644
--- a/tests/Builder/ExplainStatementTest.php
+++ b/tests/Builder/ExplainStatementTest.php
@@ -17,7 +17,7 @@ public function testBuilder(): void
$stmt = $parser->statements[0];
$this->assertEquals(
'EXPLAIN SELECT * FROM test',
- $stmt->build()
+ $stmt->build(),
);
/* Assertion 2 */
@@ -26,7 +26,7 @@ public function testBuilder(): void
$stmt = $parser->statements[0];
$this->assertEquals(
'EXPLAIN ANALYZE SELECT * FROM tablename',
- $stmt->build()
+ $stmt->build(),
);
/* Assertion 3 */
@@ -35,7 +35,7 @@ public function testBuilder(): void
$stmt = $parser->statements[0];
$this->assertEquals(
'DESC ANALYZE SELECT * FROM tablename',
- $stmt->build()
+ $stmt->build(),
);
/* Assertion 4 */
@@ -44,7 +44,7 @@ public function testBuilder(): void
$stmt = $parser->statements[0];
$this->assertEquals(
'ANALYZE SELECT * FROM tablename',
- $stmt->build()
+ $stmt->build(),
);
/* Assertion 5 */
@@ -53,7 +53,7 @@ public function testBuilder(): void
$stmt = $parser->statements[0];
$this->assertEquals(
'DESCRIBE `tablename`',
- $stmt->build()
+ $stmt->build(),
);
/* Assertion 6 */
@@ -62,7 +62,7 @@ public function testBuilder(): void
$stmt = $parser->statements[0];
$this->assertEquals(
'DESC FOR CONNECTION 458',
- $stmt->build()
+ $stmt->build(),
);
/* Assertion 7 */
@@ -71,7 +71,7 @@ public function testBuilder(): void
$stmt = $parser->statements[0];
$this->assertEquals(
'EXPLAIN FORMAT=TREE SELECT * FROM db',
- $stmt->build()
+ $stmt->build(),
);
/* Assertion 8 */
@@ -80,7 +80,7 @@ public function testBuilder(): void
$stmt = $parser->statements[0];
$this->assertEquals(
'DESCRIBE `tablename` `colname`',
- $stmt->build()
+ $stmt->build(),
);
/* Assertion 9 */
@@ -89,7 +89,7 @@ public function testBuilder(): void
$stmt = $parser->statements[0];
$this->assertEquals(
'DESCRIBE `tablename` `col%me`',
- $stmt->build()
+ $stmt->build(),
);
/* Assertion 9 */
@@ -98,7 +98,7 @@ public function testBuilder(): void
$stmt = $parser->statements[0];
$this->assertEquals(
'DESCRIBE `db`.`tablename` `col%me`',
- $stmt->build()
+ $stmt->build(),
);
}
}
diff --git a/tests/Builder/InsertStatementTest.php b/tests/Builder/InsertStatementTest.php
index 471eea092..eb928bb1a 100644
--- a/tests/Builder/InsertStatementTest.php
+++ b/tests/Builder/InsertStatementTest.php
@@ -16,7 +16,7 @@ public function testBuilder(): void
$stmt = $parser->statements[0];
$this->assertEquals(
'INSERT INTO tbl(`col1`, `col2`, `col3`) VALUES (1, "str", 3.14)',
- $stmt->build()
+ $stmt->build(),
);
/* Assertion 2 */
@@ -25,7 +25,7 @@ public function testBuilder(): void
$stmt = $parser->statements[0];
$this->assertEquals(
'INSERT INTO tbl(`order`) VALUES (1)',
- $stmt->build()
+ $stmt->build(),
);
/* Assertion 3 */
@@ -34,7 +34,7 @@ public function testBuilder(): void
$stmt = $parser->statements[0];
$this->assertEquals(
'INSERT INTO tbl SET FOO = 1',
- $stmt->build()
+ $stmt->build(),
);
/* Assertion 4 */
@@ -43,7 +43,7 @@ public function testBuilder(): void
$stmt = $parser->statements[0];
$this->assertEquals(
'INSERT INTO tbl SELECT * FROM bar',
- $stmt->build()
+ $stmt->build(),
);
/* Assertion 5 */
@@ -52,7 +52,7 @@ public function testBuilder(): void
$stmt = $parser->statements[0];
$this->assertEquals(
'INSERT INTO tbl SELECT * FROM bar ON DUPLICATE KEY UPDATE baz = 1',
- $stmt->build()
+ $stmt->build(),
);
/* Assertion 6 */
@@ -61,7 +61,7 @@ public function testBuilder(): void
$stmt = $parser->statements[0];
$this->assertEquals(
'INSERT DELAYED IGNORE INTO tbl SELECT * FROM bar',
- $stmt->build()
+ $stmt->build(),
);
}
}
diff --git a/tests/Builder/LoadStatementTest.php b/tests/Builder/LoadStatementTest.php
index bc3d1c922..423295efd 100644
--- a/tests/Builder/LoadStatementTest.php
+++ b/tests/Builder/LoadStatementTest.php
@@ -21,7 +21,7 @@ public function testBuilder(): void
$this->assertEquals(
'LOAD DATA CONCURRENT INFILE '
. '\'employee1.txt\' INTO TABLE employee',
- $stmt->build()
+ $stmt->build(),
);
/* Assertion 2 */
@@ -36,7 +36,7 @@ public function testBuilder(): void
'LOAD DATA INFILE \'/tmp/test.txt\' '
. 'INTO TABLE test FIELDS TERMINATED BY '
. '\',\' IGNORE 1 LINES',
- $stmt->build()
+ $stmt->build(),
);
/* Assertion 3 */
@@ -51,7 +51,7 @@ public function testBuilder(): void
'LOAD DATA INFILE \'employee3.txt\' '
. 'INTO TABLE employee FIELDS TERMINATED BY '
. '\',\' ENCLOSED BY \'"\'',
- $stmt->build()
+ $stmt->build(),
);
/* Assertion 4 */
@@ -72,7 +72,7 @@ public function testBuilder(): void
. 'COLUMNS TERMINATED BY \',\' '
. 'LINES TERMINATED BY \';\' '
. 'IGNORE 1 LINES (col1, col2) SET @a = 1',
- $stmt->build()
+ $stmt->build(),
);
/* Assertion 5 */
@@ -85,7 +85,7 @@ public function testBuilder(): void
$this->assertEquals(
'LOAD DATA INFILE \'/tmp/test.txt\' REPLACE '
. 'INTO TABLE test COLUMNS TERMINATED BY \',\' IGNORE 1 ROWS',
- $stmt->build()
+ $stmt->build(),
);
/* Assertion 6 */
@@ -102,7 +102,7 @@ public function testBuilder(): void
. 'INTO TABLE test PARTITION (p0, p1, p2) CHARACTER SET \'utf8\' '
. 'COLUMNS TERMINATED BY \',\' LINES TERMINATED BY \';\' '
. 'IGNORE 1 LINES (col1, col2) SET @a = 1',
- $stmt->build()
+ $stmt->build(),
);
}
}
diff --git a/tests/Builder/RenameStatementTest.php b/tests/Builder/RenameStatementTest.php
index 5d495cb70..a3abf3a3a 100644
--- a/tests/Builder/RenameStatementTest.php
+++ b/tests/Builder/RenameStatementTest.php
@@ -16,7 +16,7 @@ public function testBuilder(): void
$stmt = $parser->statements[0];
$this->assertEquals(
$query,
- $stmt->build()
+ $stmt->build(),
);
$query = 'RENAME TABLE current_db.tbl_name TO other_db.tbl_name';
@@ -24,7 +24,7 @@ public function testBuilder(): void
$stmt = $parser->statements[0];
$this->assertEquals(
$query,
- $stmt->build()
+ $stmt->build(),
);
$query = 'RENAME TABLE old_table1 TO new_table1, old_table2 TO new_table2, old_table3 TO new_table3';
@@ -32,7 +32,7 @@ public function testBuilder(): void
$stmt = $parser->statements[0];
$this->assertEquals(
$query,
- $stmt->build()
+ $stmt->build(),
);
}
}
diff --git a/tests/Builder/ReplaceStatementTest.php b/tests/Builder/ReplaceStatementTest.php
index e5f247517..36c5ddde0 100644
--- a/tests/Builder/ReplaceStatementTest.php
+++ b/tests/Builder/ReplaceStatementTest.php
@@ -15,7 +15,7 @@ public function testBuilder(): void
$stmt = $parser->statements[0];
$this->assertEquals(
'REPLACE INTO tbl(`col1`, `col2`, `col3`) VALUES (1, "str", 3.14)',
- $stmt->build()
+ $stmt->build(),
);
}
@@ -25,7 +25,7 @@ public function testBuilderSet(): void
$stmt = $parser->statements[0];
$this->assertEquals(
'REPLACE INTO tbl(`col1`, `col2`, `col3`) SET col1 = 1, col2 = "str", col3 = 3.14',
- $stmt->build()
+ $stmt->build(),
);
}
@@ -35,7 +35,7 @@ public function testBuilderSelect(): void
$stmt = $parser->statements[0];
$this->assertEquals(
'REPLACE INTO tbl(`col1`, `col2`, `col3`) SELECT col1, col2, col3 FROM tbl2',
- $stmt->build()
+ $stmt->build(),
);
}
@@ -45,7 +45,7 @@ public function testBuilderSelectDelayed(): void
$stmt = $parser->statements[0];
$this->assertEquals(
'REPLACE DELAYED INTO tbl(`col1`, `col2`, `col3`) SELECT col1, col2, col3 FROM tbl2',
- $stmt->build()
+ $stmt->build(),
);
}
}
diff --git a/tests/Builder/SelectStatementTest.php b/tests/Builder/SelectStatementTest.php
index cd9168e62..824d8b244 100644
--- a/tests/Builder/SelectStatementTest.php
+++ b/tests/Builder/SelectStatementTest.php
@@ -20,7 +20,7 @@ public function testBuilder(): void
$this->assertEquals(
'SELECT * FROM t1 LEFT JOIN (t2, t3, t4) '
. 'ON (t2.a=t1.a AND t3.b=t1.b AND t4.c=t1.c)',
- $stmt->build()
+ $stmt->build(),
);
$parser = new Parser('SELECT NULL IS NULL');
@@ -56,7 +56,7 @@ public function testBuilderUnion(): void
$this->assertEquals(
'SELECT 1 UNION SELECT 2',
- $stmt->build()
+ $stmt->build(),
);
}
@@ -94,7 +94,7 @@ public function testBuilderAlias(): void
'SELECT sgu.id, sgu.email_address FROM `sf_guard_user` sgu '
. 'RIGHT JOIN `student_course_booking` scb ON sgu.id = scb.user_id '
. 'WHERE `has_found_course` = \'1\' GROUP BY sgu.id '
- . 'ORDER BY scb.id DESC LIMIT 0,300'
+ . 'ORDER BY scb.id DESC LIMIT 0,300',
);
$stmt = $parser->statements[0];
@@ -103,7 +103,7 @@ public function testBuilderAlias(): void
. 'RIGHT JOIN `student_course_booking` AS `scb` ON sgu.id = scb.user_id '
. 'WHERE `has_found_course` = \'1\' GROUP BY sgu.id '
. 'ORDER BY scb.id DESC LIMIT 0, 300',
- $stmt->build()
+ $stmt->build(),
);
}
@@ -113,7 +113,7 @@ public function testBuilderAliasOrder(): void
'SELECT sgu.id, sgu.email_address FROM `sf_guard_user` sgu '
. 'RIGHT JOIN `student_course_booking` scb ON sgu.id = scb.user_id '
. 'WHERE `has_found_course` = \'1\' GROUP BY sgu.id '
- . 'ORDER BY scb.id LIMIT 0,300'
+ . 'ORDER BY scb.id LIMIT 0,300',
);
$stmt = $parser->statements[0];
@@ -122,7 +122,7 @@ public function testBuilderAliasOrder(): void
. 'RIGHT JOIN `student_course_booking` AS `scb` ON sgu.id = scb.user_id '
. 'WHERE `has_found_course` = \'1\' GROUP BY sgu.id '
. 'ORDER BY scb.id ASC LIMIT 0, 300',
- $stmt->build()
+ $stmt->build(),
);
}
@@ -132,7 +132,7 @@ public function testBuilderAliasOrderMultiple(): void
'SELECT sgu.id, sgu.email_address FROM `sf_guard_user` sgu '
. 'RIGHT JOIN `student_course_booking` scb ON sgu.id = scb.user_id '
. 'WHERE `has_found_course` = \'1\' GROUP BY sgu.id '
- . 'ORDER BY scb.id DESC, scb.order LIMIT 0,300'
+ . 'ORDER BY scb.id DESC, scb.order LIMIT 0,300',
);
$stmt = $parser->statements[0];
@@ -141,7 +141,7 @@ public function testBuilderAliasOrderMultiple(): void
. 'RIGHT JOIN `student_course_booking` AS `scb` ON sgu.id = scb.user_id '
. 'WHERE `has_found_course` = \'1\' GROUP BY sgu.id '
. 'ORDER BY scb.id DESC, scb.order ASC LIMIT 0, 300',
- $stmt->build()
+ $stmt->build(),
);
}
@@ -151,7 +151,7 @@ public function testBuilderAliasOrderMultipleFunctions(): void
'SELECT sgu.id, sgu.email_address FROM `sf_guard_user` sgu '
. 'RIGHT JOIN `student_course_booking` scb ON sgu.id = scb.user_id '
. 'WHERE `has_found_course` = \'1\' GROUP BY sgu.id '
- . 'ORDER BY scb.id DESC, YEAR(scb.dob) LIMIT 0,300'
+ . 'ORDER BY scb.id DESC, YEAR(scb.dob) LIMIT 0,300',
);
$stmt = $parser->statements[0];
@@ -160,7 +160,7 @@ public function testBuilderAliasOrderMultipleFunctions(): void
. 'RIGHT JOIN `student_course_booking` AS `scb` ON sgu.id = scb.user_id '
. 'WHERE `has_found_course` = \'1\' GROUP BY sgu.id '
. 'ORDER BY scb.id DESC, YEAR(scb.dob) ASC LIMIT 0, 300',
- $stmt->build()
+ $stmt->build(),
);
}
@@ -170,7 +170,7 @@ public function testBuilderAliasGroupByMultipleFunctions(): void
'SELECT sgu.id, sgu.email_address FROM `sf_guard_user` sgu '
. 'RIGHT JOIN `student_course_booking` scb ON sgu.id = scb.user_id '
. 'WHERE `has_found_course` = \'1\' '
- . 'GROUP BY scb.id, YEAR(scb.dob) LIMIT 0,300'
+ . 'GROUP BY scb.id, YEAR(scb.dob) LIMIT 0,300',
);
$stmt = $parser->statements[0];
@@ -179,7 +179,7 @@ public function testBuilderAliasGroupByMultipleFunctions(): void
. 'RIGHT JOIN `student_course_booking` AS `scb` ON sgu.id = scb.user_id '
. 'WHERE `has_found_course` = \'1\' '
. 'GROUP BY scb.id, YEAR(scb.dob) LIMIT 0, 300',
- $stmt->build()
+ $stmt->build(),
);
}
@@ -189,7 +189,7 @@ public function testBuilderAliasGroupByMultipleFunctionsOrderRemoved(): void
'SELECT sgu.id, sgu.email_address FROM `sf_guard_user` sgu '
. 'RIGHT JOIN `student_course_booking` scb ON sgu.id = scb.user_id '
. 'WHERE `has_found_course` = \'1\' '
- . 'GROUP BY scb.id ASC, YEAR(scb.dob) DESC LIMIT 0,300'
+ . 'GROUP BY scb.id ASC, YEAR(scb.dob) DESC LIMIT 0,300',
);
$stmt = $parser->statements[0];
@@ -201,7 +201,7 @@ public function testBuilderAliasGroupByMultipleFunctionsOrderRemoved(): void
. 'RIGHT JOIN `student_course_booking` AS `scb` ON sgu.id = scb.user_id '
. 'WHERE `has_found_course` = \'1\' '
. 'GROUP BY scb.id, YEAR(scb.dob) LIMIT 0, 300',
- $stmt->build()
+ $stmt->build(),
);
}
@@ -211,7 +211,7 @@ public function testBuilderAliasOrderCase(): void
'SELECT * FROM `world_borders` ORDER BY CASE '
. 'WHEN REGION = 2 THEN 99 '
. 'WHEN REGION > 3 THEN REGION+1 '
- . 'ELSE 100 END LIMIT 0,300'
+ . 'ELSE 100 END LIMIT 0,300',
);
$stmt = $parser->statements[0];
@@ -220,7 +220,7 @@ public function testBuilderAliasOrderCase(): void
. 'WHEN REGION = 2 THEN 99 '
. 'WHEN REGION > 3 THEN REGION+1 '
. 'ELSE 100 END ASC LIMIT 0, 300',
- $stmt->build()
+ $stmt->build(),
);
}
@@ -230,7 +230,7 @@ public function testBuilderAliasGroupByCase(): void
'SELECT * FROM `world_borders` GROUP BY CASE '
. 'WHEN REGION = 2 THEN 99 '
. 'WHEN REGION > 3 THEN REGION+1 '
- . 'ELSE 100 END LIMIT 0,300'
+ . 'ELSE 100 END LIMIT 0,300',
);
$stmt = $parser->statements[0];
@@ -239,7 +239,7 @@ public function testBuilderAliasGroupByCase(): void
. 'WHEN REGION = 2 THEN 99 '
. 'WHEN REGION > 3 THEN REGION+1 '
. 'ELSE 100 END LIMIT 0, 300',
- $stmt->build()
+ $stmt->build(),
);
}
@@ -252,7 +252,7 @@ public function testBuilderEndOptions(): void
$this->assertEquals(
$query,
- $stmt->build()
+ $stmt->build(),
);
/* Assertion 2 */
@@ -262,7 +262,7 @@ public function testBuilderEndOptions(): void
$this->assertEquals(
$query,
- $stmt->build()
+ $stmt->build(),
);
}
@@ -278,7 +278,7 @@ public function testBuilderIntoOptions(): void
$this->assertEquals(
$query,
- $stmt->build()
+ $stmt->build(),
);
}
@@ -290,7 +290,7 @@ public function testBuilderGroupBy(): void
$this->assertEquals(
$query,
- $stmt->build()
+ $stmt->build(),
);
}
@@ -302,7 +302,7 @@ public function testBuilderGroupByWithRollup(): void
$this->assertEquals(
$query,
- $stmt->build()
+ $stmt->build(),
);
}
@@ -314,7 +314,7 @@ public function testBuilderGroupByMultipleColumnsWithRollup(): void
$this->assertEquals(
$query,
- $stmt->build()
+ $stmt->build(),
);
}
@@ -326,7 +326,7 @@ public function testBuilderGroupByWithRollupWithOtherClauses(): void
$this->assertEquals(
$query,
- $stmt->build()
+ $stmt->build(),
);
}
@@ -338,7 +338,7 @@ public function testBuilderIndexHint(): void
$this->assertEquals(
$query,
- $stmt->build()
+ $stmt->build(),
);
}
@@ -350,7 +350,7 @@ public function testBuilderSurroundedByParanthesisWithLimit(): void
$this->assertEquals(
'SELECT first_name FROM `actor` LIMIT 1, 2',
- $stmt->build()
+ $stmt->build(),
);
}
}
diff --git a/tests/Builder/SetStatementTest.php b/tests/Builder/SetStatementTest.php
index 5f97c8bca..baca7f5ae 100644
--- a/tests/Builder/SetStatementTest.php
+++ b/tests/Builder/SetStatementTest.php
@@ -19,7 +19,7 @@ public function testBuilderView(): void
$this->assertEquals(
$query,
- $stmt->build()
+ $stmt->build(),
);
/* Assertion 2 */
@@ -30,7 +30,7 @@ public function testBuilderView(): void
$this->assertEquals(
$query,
- $stmt->build()
+ $stmt->build(),
);
/* Assertion 3 */
@@ -41,7 +41,7 @@ public function testBuilderView(): void
$this->assertEquals(
$query,
- $stmt->build()
+ $stmt->build(),
);
/* Assertion 4 */
@@ -52,7 +52,7 @@ public function testBuilderView(): void
$this->assertEquals(
'SET NAMES \'utf8\' COLLATE \'utf8_general_ci\'',
- $stmt->build()
+ $stmt->build(),
);
/* Assertion 5 */
@@ -63,7 +63,7 @@ public function testBuilderView(): void
$this->assertEquals(
'SET NAMES \'utf8\' DEFAULT',
- $stmt->build()
+ $stmt->build(),
);
/* Assertion 6 */
@@ -74,7 +74,7 @@ public function testBuilderView(): void
$this->assertEquals(
'SET sql_mode = \'TRADITIONAL\'',
- $stmt->build()
+ $stmt->build(),
);
/* Assertion 7 */
@@ -85,7 +85,7 @@ public function testBuilderView(): void
$this->assertEquals(
'SET SESSION sql_mode = \'TRADITIONAL\'',
- $stmt->build()
+ $stmt->build(),
);
/* Assertion 8 */
@@ -96,7 +96,7 @@ public function testBuilderView(): void
$this->assertEquals(
'SET GLOBAL sql_mode = \'TRADITIONAL\'',
- $stmt->build()
+ $stmt->build(),
);
/* Assertion 9 */
@@ -107,7 +107,7 @@ public function testBuilderView(): void
$this->assertEquals(
'SET SESSION sql_mode = \'TRADITIONAL\'',
- $stmt->build()
+ $stmt->build(),
);
/* Assertion 10 */
@@ -118,7 +118,7 @@ public function testBuilderView(): void
$this->assertEquals(
'SET GLOBAL sql_mode = \'TRADITIONAL\'',
- $stmt->build()
+ $stmt->build(),
);
/* Assertion 11 */
@@ -129,7 +129,7 @@ public function testBuilderView(): void
$this->assertEquals(
'SET @@sql_mode = \'TRADITIONAL\'',
- $stmt->build()
+ $stmt->build(),
);
/* Assertion 12 */
@@ -140,7 +140,7 @@ public function testBuilderView(): void
$this->assertEquals(
'SET PERSIST sql_mode = \'TRADITIONAL\'',
- $stmt->build()
+ $stmt->build(),
);
/* Assertion 13 */
@@ -151,7 +151,7 @@ public function testBuilderView(): void
$this->assertEquals(
'SET PERSIST_ONLY sql_mode = \'TRADITIONAL\'',
- $stmt->build()
+ $stmt->build(),
);
/* Assertion 14 */
@@ -162,7 +162,7 @@ public function testBuilderView(): void
$this->assertEquals(
'SET PERSIST sql_mode = \'TRADITIONAL\'',
- $stmt->build()
+ $stmt->build(),
);
/* Assertion 15 */
@@ -173,7 +173,7 @@ public function testBuilderView(): void
$this->assertEquals(
'SET PERSIST_ONLY sql_mode = \'TRADITIONAL\'',
- $stmt->build()
+ $stmt->build(),
);
}
}
diff --git a/tests/Builder/StatementTest.php b/tests/Builder/StatementTest.php
index 14339e185..4b8ac4109 100644
--- a/tests/Builder/StatementTest.php
+++ b/tests/Builder/StatementTest.php
@@ -38,7 +38,7 @@ public function testBuilder(): void
'FROM `film`, `actor` ' .
'WHERE film_id > 10 OR actor.age > 25 ' .
'LIMIT 10, 1',
- (string) $stmt
+ (string) $stmt,
);
}
diff --git a/tests/Builder/TransactionStatementTest.php b/tests/Builder/TransactionStatementTest.php
index 4da0dd144..fdbde572d 100644
--- a/tests/Builder/TransactionStatementTest.php
+++ b/tests/Builder/TransactionStatementTest.php
@@ -24,7 +24,7 @@ public function testBuilder(): void
'SELECT @A:=SUM(salary) FROM table1 WHERE type=1;' .
'UPDATE table2 SET summary = @A WHERE type=1;' .
'COMMIT',
- $stmt->build()
+ $stmt->build(),
);
}
}
diff --git a/tests/Builder/UpdateStatementTest.php b/tests/Builder/UpdateStatementTest.php
index 1e21cfc62..1eed5e77e 100644
--- a/tests/Builder/UpdateStatementTest.php
+++ b/tests/Builder/UpdateStatementTest.php
@@ -13,28 +13,28 @@ public function testBuilder(): void
{
/* Assertion 1 */
$parser = new Parser(
- 'update user u left join user_detail ud on u.id = ud.user_id set ud.ip =\'33\' where u.id = 1'
+ 'update user u left join user_detail ud on u.id = ud.user_id set ud.ip =\'33\' where u.id = 1',
);
$stmt = $parser->statements[0];
$this->assertEquals(
'UPDATE user AS `u` LEFT JOIN user_detail AS `ud` ON u.id = ud.user_id SET ud.ip = \'33\' WHERE u.id = 1',
- $stmt->build()
+ $stmt->build(),
);
/* Assertion 2 */
$parser = new Parser('update user u join user_detail ud on u.id = ud.user_id set ud.ip =\'33\' where u.id = 1');
$stmt = $parser->statements[0];
$this->assertEquals(
'UPDATE user AS `u` JOIN user_detail AS `ud` ON u.id = ud.user_id SET ud.ip = \'33\' WHERE u.id = 1',
- $stmt->build()
+ $stmt->build(),
);
/* Assertion 3 */
$parser = new Parser(
- 'update user u inner join user_detail ud on u.id = ud.user_id set ud.ip =\'33\' where u.id = 1'
+ 'update user u inner join user_detail ud on u.id = ud.user_id set ud.ip =\'33\' where u.id = 1',
);
$stmt = $parser->statements[0];
$this->assertEquals(
'UPDATE user AS `u` INNER JOIN user_detail AS `ud` ON u.id = ud.user_id SET ud.ip = \'33\' WHERE u.id = 1',
- $stmt->build()
+ $stmt->build(),
);
}
}
diff --git a/tests/Components/Array2dTest.php b/tests/Components/Array2dTest.php
index f37241095..fe8758078 100644
--- a/tests/Components/Array2dTest.php
+++ b/tests/Components/Array2dTest.php
@@ -20,7 +20,7 @@ public function testParse(): void
1,
2,
],
- $arrays[0]->values
+ $arrays[0]->values,
);
}
@@ -29,7 +29,7 @@ public function testBuildAll(): void
$arrays = Array2d::parse(new Parser(), $this->getTokensList('(1, 2), (3, 4), (5, 6)'));
$this->assertEquals(
'(1, 2), (3, 4), (5, 6)',
- ArrayObj::buildAll($arrays)
+ ArrayObj::buildAll($arrays),
);
}
@@ -56,7 +56,7 @@ public function testParseErr3(): void
$this->assertCount(1, $parser->errors);
$this->assertEquals(
'An opening bracket followed by a set of values was expected.',
- $parser->errors[0]->getMessage()
+ $parser->errors[0]->getMessage(),
);
}
@@ -67,7 +67,7 @@ public function testParseErr4(): void
$this->assertCount(1, $parser->errors);
$this->assertEquals(
'An opening bracket followed by a set of values was expected.',
- $parser->errors[0]->getMessage()
+ $parser->errors[0]->getMessage(),
);
}
@@ -78,7 +78,7 @@ public function testParseErr5(): void
$this->assertCount(1, $parser->errors);
$this->assertEquals(
'An opening bracket followed by a set of values was expected.',
- $parser->errors[0]->getMessage()
+ $parser->errors[0]->getMessage(),
);
}
@@ -89,7 +89,7 @@ public function testParseErr6(): void
$this->assertCount(1, $parser->errors);
$this->assertEquals(
'2 values were expected, but found 1.',
- $parser->errors[0]->getMessage()
+ $parser->errors[0]->getMessage(),
);
}
}
diff --git a/tests/Components/ArrayObjTest.php b/tests/Components/ArrayObjTest.php
index e2f35a662..04cf71513 100644
--- a/tests/Components/ArrayObjTest.php
+++ b/tests/Components/ArrayObjTest.php
@@ -32,7 +32,7 @@ public function testParseType(): void
[
'type' => Expression::class,
'typeOptions' => ['breakOnParentheses' => true],
- ]
+ ],
);
$this->assertInstanceOf(Expression::class, $components[0]);
$this->assertInstanceOf(Expression::class, $components[1]);
@@ -46,9 +46,7 @@ public function testParse(string $test): void
$this->runParserTest($test);
}
- /**
- * @return string[][]
- */
+ /** @return string[][] */
public static function parseProvider(): array
{
return [
diff --git a/tests/Components/CaseExpressionTest.php b/tests/Components/CaseExpressionTest.php
index df1dc5b5c..1488caa7a 100644
--- a/tests/Components/CaseExpressionTest.php
+++ b/tests/Components/CaseExpressionTest.php
@@ -15,11 +15,11 @@ public function testParseBuild(): void
$caseExprQuery = 'case 1 when 1 then "Some" else "Other" end';
$component = CaseExpression::parse(
new Parser(),
- $this->getTokensList($caseExprQuery)
+ $this->getTokensList($caseExprQuery),
);
$this->assertEquals(
$component->build(),
- 'CASE 1 WHEN 1 THEN "Some" ELSE "Other" END'
+ 'CASE 1 WHEN 1 THEN "Some" ELSE "Other" END',
);
}
@@ -28,11 +28,11 @@ public function testParseBuild2(): void
$caseExprQuery = 'case when 1=1 then "India" else "Other" end';
$component = CaseExpression::parse(
new Parser(),
- $this->getTokensList($caseExprQuery)
+ $this->getTokensList($caseExprQuery),
);
$this->assertEquals(
$component->build(),
- 'CASE WHEN 1=1 THEN "India" ELSE "Other" END'
+ 'CASE WHEN 1=1 THEN "India" ELSE "Other" END',
);
}
@@ -42,11 +42,11 @@ public function testParseBuild3(): void
. 'when 2 then "SomeOther" else "Other" end';
$component = CaseExpression::parse(
new Parser(),
- $this->getTokensList($caseExprQuery)
+ $this->getTokensList($caseExprQuery),
);
$this->assertEquals(
$component->build(),
- 'CASE 1 WHEN 1 THEN "Some" WHEN 2 THEN "SomeOther" ELSE "Other" END'
+ 'CASE 1 WHEN 1 THEN "Some" WHEN 2 THEN "SomeOther" ELSE "Other" END',
);
}
@@ -56,11 +56,11 @@ public function testParseBuild4(): void
. 'when 2 then "SomeOther" end';
$component = CaseExpression::parse(
new Parser(),
- $this->getTokensList($caseExprQuery)
+ $this->getTokensList($caseExprQuery),
);
$this->assertEquals(
$component->build(),
- 'CASE 1 WHEN 1 THEN "Some" WHEN 2 THEN "SomeOther" END'
+ 'CASE 1 WHEN 1 THEN "Some" WHEN 2 THEN "SomeOther" END',
);
}
@@ -70,11 +70,11 @@ public function testParseBuild5(): void
. 'when 1=2 then "SomeOther" else "Other" end';
$component = CaseExpression::parse(
new Parser(),
- $this->getTokensList($caseExprQuery)
+ $this->getTokensList($caseExprQuery),
);
$this->assertEquals(
$component->build(),
- 'CASE WHEN 1=1 THEN "Some" WHEN 1=2 THEN "SomeOther" ELSE "Other" END'
+ 'CASE WHEN 1=1 THEN "Some" WHEN 1=2 THEN "SomeOther" ELSE "Other" END',
);
}
@@ -84,11 +84,11 @@ public function testParseBuild6(): void
. 'when 1=2 then "SomeOther" end';
$component = CaseExpression::parse(
new Parser(),
- $this->getTokensList($caseExprQuery)
+ $this->getTokensList($caseExprQuery),
);
$this->assertEquals(
$component->build(),
- 'CASE WHEN 1=1 THEN "Some" WHEN 1=2 THEN "SomeOther" END'
+ 'CASE WHEN 1=1 THEN "Some" WHEN 1=2 THEN "SomeOther" END',
);
}
@@ -98,11 +98,11 @@ public function testParseBuild7(): void
. 'when 1=2 then "SomeOther" end AS foo';
$component = CaseExpression::parse(
new Parser(),
- $this->getTokensList($caseExprQuery)
+ $this->getTokensList($caseExprQuery),
);
$this->assertEquals(
$component->build(),
- 'CASE WHEN 1=1 THEN "Some" WHEN 1=2 THEN "SomeOther" END AS `foo`'
+ 'CASE WHEN 1=1 THEN "Some" WHEN 1=2 THEN "SomeOther" END AS `foo`',
);
}
@@ -112,11 +112,11 @@ public function testParseBuild8(): void
. 'when 1=2 then "SomeOther" end foo';
$component = CaseExpression::parse(
new Parser(),
- $this->getTokensList($caseExprQuery)
+ $this->getTokensList($caseExprQuery),
);
$this->assertEquals(
$component->build(),
- 'CASE WHEN 1=1 THEN "Some" WHEN 1=2 THEN "SomeOther" END AS `foo`'
+ 'CASE WHEN 1=1 THEN "Some" WHEN 1=2 THEN "SomeOther" END AS `foo`',
);
}
diff --git a/tests/Components/ConditionTest.php b/tests/Components/ConditionTest.php
index 909e4d1cf..ae417df25 100644
--- a/tests/Components/ConditionTest.php
+++ b/tests/Components/ConditionTest.php
@@ -20,7 +20,7 @@ public function testParseBetween(): void
{
$component = Condition::parse(
new Parser(),
- $this->getTokensList('(id BETWEEN 10 AND 20) OR (id BETWEEN 30 AND 40)')
+ $this->getTokensList('(id BETWEEN 10 AND 20) OR (id BETWEEN 30 AND 40)'),
);
$this->assertEquals($component[0]->expr, '(id BETWEEN 10 AND 20)');
$this->assertEquals($component[1]->expr, 'OR');
diff --git a/tests/Components/CreateDefinitionTest.php b/tests/Components/CreateDefinitionTest.php
index 304541dfb..f30f49e52 100644
--- a/tests/Components/CreateDefinitionTest.php
+++ b/tests/Components/CreateDefinitionTest.php
@@ -15,7 +15,7 @@ public function testParse(): void
{
$component = CreateDefinition::parse(
new Parser(),
- $this->getTokensList('(str TEXT, FULLTEXT INDEX indx (str))')
+ $this->getTokensList('(str TEXT, FULLTEXT INDEX indx (str))'),
);
$this->assertEquals('str', $component[0]->name);
$this->assertEquals('FULLTEXT INDEX', $component[1]->key->type);
@@ -27,7 +27,7 @@ public function testParse2(): void
{
$component = CreateDefinition::parse(
new Parser(),
- $this->getTokensList('(str TEXT NOT NULL INVISIBLE)')
+ $this->getTokensList('(str TEXT NOT NULL INVISIBLE)'),
);
$this->assertEquals('str', $component[0]->name);
$this->assertEquals('TEXT', $component[0]->type->name);
@@ -40,13 +40,13 @@ public function testParseErr1(): void
$parser = new Parser();
$component = CreateDefinition::parse(
$parser,
- $this->getTokensList('(str TEXT, FULLTEXT INDEX indx (str)')
+ $this->getTokensList('(str TEXT, FULLTEXT INDEX indx (str)'),
);
$this->assertCount(2, $component);
$this->assertEquals(
'A closing bracket was expected.',
- $parser->errors[0]->getMessage()
+ $parser->errors[0]->getMessage(),
);
}
@@ -55,12 +55,12 @@ public function testParseErr2(): void
$parser = new Parser();
CreateDefinition::parse(
$parser,
- $this->getTokensList(')')
+ $this->getTokensList(')'),
);
$this->assertEquals(
'An opening bracket was expected.',
- $parser->errors[0]->getMessage()
+ $parser->errors[0]->getMessage(),
);
}
@@ -72,14 +72,14 @@ public function testBuild(): void
'`customer_id` smallint(5) unsigned NOT NULL,' .
'CONSTRAINT `fk_payment_customer` FOREIGN KEY (`customer_id`) ' .
'REFERENCES `customer` (`customer_id`) ON UPDATE CASCADE' .
- ') ENGINE=InnoDB"'
+ ') ENGINE=InnoDB"',
);
$this->assertInstanceOf(CreateStatement::class, $parser->statements[0]);
$this->assertIsArray($parser->statements[0]->fields);
$this->assertEquals(
'CONSTRAINT `fk_payment_customer` FOREIGN KEY (`customer_id`) ' .
'REFERENCES `customer` (`customer_id`) ON UPDATE CASCADE',
- $parser->statements[0]->fields[1]->build()
+ $parser->statements[0]->fields[1]->build(),
);
}
@@ -92,14 +92,14 @@ public function testBuild2(): void
'`customer_data` longtext CHARACTER SET utf8mb4 CHARSET utf8mb4_bin NOT NULL ' .
'CHECK (json_valid(customer_data)),CONSTRAINT `fk_payment_customer` FOREIGN KEY ' .
'(`customer_id`) REFERENCES `customer` (`customer_id`) ON UPDATE CASCADE' .
- ') ENGINE=InnoDB"'
+ ') ENGINE=InnoDB"',
);
$this->assertInstanceOf(CreateStatement::class, $parser->statements[0]);
$this->assertIsArray($parser->statements[0]->fields);
$this->assertEquals(
'CONSTRAINT `fk_payment_customer` FOREIGN KEY (`customer_id`) ' .
'REFERENCES `customer` (`customer_id`) ON UPDATE CASCADE',
- $parser->statements[0]->fields[2]->build()
+ $parser->statements[0]->fields[2]->build(),
);
}
@@ -119,21 +119,21 @@ public function testBuild3(): void
. ' PRIMARY KEY (`id`)'
. ') ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ;'
. ''
- . 'ALTER TABLE `searches` ADD `admins_only` BOOLEAN NOT NULL DEFAULT FALSE AFTER `show_separators`;'
+ . 'ALTER TABLE `searches` ADD `admins_only` BOOLEAN NOT NULL DEFAULT FALSE AFTER `show_separators`;',
);
$this->assertInstanceOf(CreateStatement::class, $parser->statements[1]);
$this->assertIsArray($parser->statements[1]->fields);
$this->assertEquals(
'`public_name` varchar(120) COLLATE utf8_unicode_ci NOT NULL',
- $parser->statements[1]->fields[2]->build()
+ $parser->statements[1]->fields[2]->build(),
);
$this->assertEquals(
'`show_separators` tinyint(1) NOT NULL DEFAULT \'0\'',
- $parser->statements[1]->fields[5]->build()
+ $parser->statements[1]->fields[5]->build(),
);
$this->assertEquals(
'`show_separators_two` tinyint(1) NOT NULL DEFAULT FALSE',
- $parser->statements[1]->fields[6]->build()
+ $parser->statements[1]->fields[6]->build(),
);
}
@@ -146,13 +146,13 @@ public function testBuildWithInvisibleKeyword(): void
'`customer_data` longtext CHARACTER SET utf8mb4 CHARSET utf8mb4_bin NOT NULL ' .
'CHECK (json_valid(customer_data)),CONSTRAINT `fk_payment_customer` FOREIGN KEY ' .
'(`customer_id`) REFERENCES `customer` (`customer_id`) ON UPDATE CASCADE' .
- ') ENGINE=InnoDB"'
+ ') ENGINE=InnoDB"',
);
$this->assertInstanceOf(CreateStatement::class, $parser->statements[0]);
$this->assertIsArray($parser->statements[0]->fields);
$this->assertEquals(
'`customer_id` smallint(5) UNSIGNED NOT NULL INVISIBLE',
- $parser->statements[0]->fields[0]->build()
+ $parser->statements[0]->fields[0]->build(),
);
}
diff --git a/tests/Components/ExpressionArrayTest.php b/tests/Components/ExpressionArrayTest.php
index 2bf44d04b..9233bab64 100644
--- a/tests/Components/ExpressionArrayTest.php
+++ b/tests/Components/ExpressionArrayTest.php
@@ -15,7 +15,7 @@ public function testParse(): void
$component = ExpressionArray::parse(
new Parser(),
$this->getTokensList('(expr)'),
- ['breakOnParentheses' => true]
+ ['breakOnParentheses' => true],
);
$this->assertEquals([], $component);
}
@@ -25,7 +25,7 @@ public function testParse2(): void
$component = ExpressionArray::parse(
new Parser(),
$this->getTokensList('(expr) +'),
- ['parenthesesDelimited' => true]
+ ['parenthesesDelimited' => true],
);
$this->assertCount(1, $component);
$this->assertEquals('(expr)', $component[0]->expr);
@@ -35,7 +35,7 @@ public function testParseWithCommentsNoOptions(): void
{
$component = ExpressionArray::parse(
new Parser(),
- $this->getTokensList('(expr) -- comment ?')
+ $this->getTokensList('(expr) -- comment ?'),
);
$this->assertCount(1, $component);
$this->assertEquals('(expr)', $component[0]->expr);
@@ -46,7 +46,7 @@ public function testParseWithCommentsAndOptions(): void
$component = ExpressionArray::parse(
new Parser(),
$this->getTokensList('(expr -- comment ?)'),
- ['parenthesesDelimited' => true]
+ ['parenthesesDelimited' => true],
);
$this->assertCount(1, $component);
$this->assertEquals('(expr', $component[0]->expr);
diff --git a/tests/Components/ExpressionTest.php b/tests/Components/ExpressionTest.php
index a0e0d708e..812060130 100644
--- a/tests/Components/ExpressionTest.php
+++ b/tests/Components/ExpressionTest.php
@@ -49,9 +49,7 @@ public function testParseErr(string $expr, string $error): void
$this->assertEquals($errors[0][0], $error);
}
- /**
- * @return string[][]
- */
+ /** @return string[][] */
public static function parseErrProvider(): array
{
return [
@@ -88,13 +86,11 @@ public function testBuildAll(): void
];
$this->assertEquals(
Expression::buildAll($component),
- '1 + 2 AS `three`, 1 + 3 AS `four`'
+ '1 + 2 AS `three`, 1 + 3 AS `four`',
);
}
- /**
- * @return string[][]
- */
+ /** @return string[][] */
public static function mysqlCommandsProvider(): array
{
return [
diff --git a/tests/Components/GroupKeywordTest.php b/tests/Components/GroupKeywordTest.php
index 93bf5be7b..838e725c6 100644
--- a/tests/Components/GroupKeywordTest.php
+++ b/tests/Components/GroupKeywordTest.php
@@ -15,9 +15,7 @@
class GroupKeywordTest extends TestCase
{
- /**
- * @return Generator, string}>
- */
+ /** @return Generator, string}> */
public static function provideExpressions(): Generator
{
yield 'With no expression at all' => [[], ''];
@@ -53,9 +51,7 @@ public static function provideExpressions(): Generator
];
}
- /**
- * @param GroupKeyword|array $component
- */
+ /** @param GroupKeyword|array $component */
#[DataProvider('provideExpressions')]
public function testBuild($component, string $expected): void
{
@@ -71,9 +67,7 @@ private static function makeComponentFrom(string $string): GroupKeyword
return new GroupKeyword(new Expression($string));
}
- /**
- * @return array
- */
+ /** @return array */
private static function makeComponentsFrom(string ...$string): array
{
return array_map([self::class, 'makeComponentFrom'], $string);
diff --git a/tests/Components/JoinKeywordTest.php b/tests/Components/JoinKeywordTest.php
index dbb43f7f0..705d516dc 100644
--- a/tests/Components/JoinKeywordTest.php
+++ b/tests/Components/JoinKeywordTest.php
@@ -34,13 +34,13 @@ public function testBuildAll(): void
new Parser(),
$this->getTokensList(
'LEFT JOIN (t2 CROSS JOIN t3 CROSS JOIN t4) ' .
- 'ON (t2.a=t1.a AND t3.b=t1.b AND t4.c=t1.c)'
- )
+ 'ON (t2.a=t1.a AND t3.b=t1.b AND t4.c=t1.c)',
+ ),
);
$this->assertEquals(
'LEFT JOIN (t2 CROSS JOIN t3 CROSS JOIN t4) ' .
'ON (t2.a=t1.a AND t3.b=t1.b AND t4.c=t1.c)',
- JoinKeyword::buildAll($component)
+ JoinKeyword::buildAll($component),
);
}
}
diff --git a/tests/Components/KeyTest.php b/tests/Components/KeyTest.php
index 6f5a730df..19946b797 100644
--- a/tests/Components/KeyTest.php
+++ b/tests/Components/KeyTest.php
@@ -19,7 +19,7 @@ public function testParse(): void
{
$component = Key::parse(
new Parser(),
- $this->getTokensList('')
+ $this->getTokensList(''),
);
$this->assertNull($component->type);
$this->assertNull($component->options);
@@ -28,7 +28,7 @@ public function testParse(): void
$this->assertSame([], $component->columns);
$this->assertSame(
'()',
- $component->build()
+ $component->build(),
);
}
@@ -36,7 +36,7 @@ public function testParseKeyWithoutOptions(): void
{
$component = Key::parse(
new Parser(),
- $this->getTokensList('KEY `alias_type_idx` (`alias_type`),')
+ $this->getTokensList('KEY `alias_type_idx` (`alias_type`),'),
);
$this->assertEquals('KEY', $component->type);
$this->assertEquals('alias_type_idx', $component->name);
@@ -45,7 +45,7 @@ public function testParseKeyWithoutOptions(): void
$this->assertSame([['name' => 'alias_type']], $component->columns);
$this->assertSame(
'KEY `alias_type_idx` (`alias_type`)',
- $component->build()
+ $component->build(),
);
}
@@ -53,7 +53,7 @@ public function testParseKeyWithLengthWithoutOptions(): void
{
$component = Key::parse(
new Parser(),
- $this->getTokensList('KEY `alias_type_idx` (`alias_type`(10)),')
+ $this->getTokensList('KEY `alias_type_idx` (`alias_type`(10)),'),
);
$this->assertEquals('KEY', $component->type);
$this->assertEquals('alias_type_idx', $component->name);
@@ -62,7 +62,7 @@ public function testParseKeyWithLengthWithoutOptions(): void
$this->assertSame([['name' => 'alias_type', 'length' => 10]], $component->columns);
$this->assertSame(
'KEY `alias_type_idx` (`alias_type`(10))',
- $component->build()
+ $component->build(),
);
}
@@ -70,7 +70,7 @@ public function testParseKeyWithLengthWithoutOptionsWithOrder(): void
{
$component = Key::parse(
new Parser(),
- $this->getTokensList('KEY `alias_type_idx` (`alias_type`(10) ASC),')
+ $this->getTokensList('KEY `alias_type_idx` (`alias_type`(10) ASC),'),
);
$this->assertEquals('KEY', $component->type);
$this->assertEquals('alias_type_idx', $component->name);
@@ -79,7 +79,7 @@ public function testParseKeyWithLengthWithoutOptionsWithOrder(): void
$this->assertSame([['name' => 'alias_type', 'length' => 10, 'order' => 'ASC']], $component->columns);
$this->assertSame(
'KEY `alias_type_idx` (`alias_type`(10) ASC)',
- $component->build()
+ $component->build(),
);
}
@@ -87,7 +87,7 @@ public function testParseKeyWithoutOptionsWithOrderLowercase(): void
{
$component = Key::parse(
new Parser(),
- $this->getTokensList('KEY `alias_type_idx` (`alias_type` desc),')
+ $this->getTokensList('KEY `alias_type_idx` (`alias_type` desc),'),
);
$this->assertEquals('KEY', $component->type);
$this->assertEquals('alias_type_idx', $component->name);
@@ -96,7 +96,7 @@ public function testParseKeyWithoutOptionsWithOrderLowercase(): void
$this->assertSame([['name' => 'alias_type', 'order' => 'DESC']], $component->columns);
$this->assertSame(
'KEY `alias_type_idx` (`alias_type` DESC)',
- $component->build()
+ $component->build(),
);
}
@@ -104,7 +104,7 @@ public function testParseKeyWithoutOptionsWithOrder(): void
{
$component = Key::parse(
new Parser(),
- $this->getTokensList('KEY `alias_type_idx` (`alias_type` DESC),')
+ $this->getTokensList('KEY `alias_type_idx` (`alias_type` DESC),'),
);
$this->assertEquals('KEY', $component->type);
$this->assertEquals('alias_type_idx', $component->name);
@@ -113,7 +113,7 @@ public function testParseKeyWithoutOptionsWithOrder(): void
$this->assertSame([['name' => 'alias_type', 'order' => 'DESC']], $component->columns);
$this->assertSame(
'KEY `alias_type_idx` (`alias_type` DESC)',
- $component->build()
+ $component->build(),
);
}
@@ -121,7 +121,7 @@ public function testParseKeyWithLengthWithOptions(): void
{
$component = Key::parse(
new Parser(),
- $this->getTokensList('KEY `alias_type_idx` (`alias_type`(10)) COMMENT \'my comment\',')
+ $this->getTokensList('KEY `alias_type_idx` (`alias_type`(10)) COMMENT \'my comment\','),
);
$this->assertEquals('KEY', $component->type);
$this->assertEquals('alias_type_idx', $component->name);
@@ -133,13 +133,13 @@ public function testParseKeyWithLengthWithOptions(): void
'expr' => '\'my comment\'',
'value' => 'my comment',
],
- ]
+ ],
), $component->options);
$this->assertNull($component->expr);
$this->assertSame([['name' => 'alias_type', 'length' => 10]], $component->columns);
$this->assertSame(
'KEY `alias_type_idx` (`alias_type`(10)) COMMENT \'my comment\'',
- $component->build()
+ $component->build(),
);
}
@@ -152,8 +152,8 @@ public function testParseKeyWithLengthWithAllOptions(): void
// Only ENGINE_ATTRIBUTE gives a not supported error but is still a valid syntax
'KEY `alias_type_idx` (`alias_type`(10))'
. ' COMMENT \'my comment\' VISIBLE KEY_BLOCK_SIZE=1'
- . ' INVISIBLE ENGINE_ATTRIBUTE \'foo\' SECONDARY_ENGINE_ATTRIBUTE=\'bar\' USING BTREE,'
- )
+ . ' INVISIBLE ENGINE_ATTRIBUTE \'foo\' SECONDARY_ENGINE_ATTRIBUTE=\'bar\' USING BTREE,',
+ ),
);
$this->assertEquals('KEY', $component->type);
$this->assertEquals('alias_type_idx', $component->name);
@@ -191,7 +191,7 @@ public function testParseKeyWithLengthWithAllOptions(): void
'expr' => '\'bar\'',
'value' => 'bar',
],
- ]
+ ],
), $component->options);
$this->assertNull($component->expr);
$this->assertSame([['name' => 'alias_type', 'length' => 10]], $component->columns);
@@ -202,8 +202,8 @@ public function testParseKeyExpressionWithoutOptions(): void
$component = Key::parse(
new Parser(),
$this->getTokensList(
- 'KEY `updated_tz_ind2` ((convert_tz(`cache_updated`,_utf8mb4\'GMT\',_utf8mb4\'GB\'))),'
- )
+ 'KEY `updated_tz_ind2` ((convert_tz(`cache_updated`,_utf8mb4\'GMT\',_utf8mb4\'GB\'))),',
+ ),
);
$this->assertEquals('KEY', $component->type);
$this->assertEquals('updated_tz_ind2', $component->name);
@@ -214,7 +214,7 @@ public function testParseKeyExpressionWithoutOptions(): void
$this->assertSame([], $component->columns);
$this->assertSame(
'KEY `updated_tz_ind2` ((convert_tz(`cache_updated`,_utf8mb4\'GMT\',_utf8mb4\'GB\'))) ',
- $component->build()
+ $component->build(),
);
}
@@ -225,8 +225,8 @@ public function testParseKeyExpressionWithOptions(): void
$this->getTokensList(
'KEY `updated_tz_ind2`'
. ' ((convert_tz(`cache_updated`,_utf8mb4\'GMT\',_utf8mb4\'GB\')))'
- . ' COMMENT \'my comment\','
- )
+ . ' COMMENT \'my comment\',',
+ ),
);
$this->assertEquals('KEY', $component->type);
$this->assertEquals('updated_tz_ind2', $component->name);
@@ -238,7 +238,7 @@ public function testParseKeyExpressionWithOptions(): void
'expr' => '\'my comment\'',
'value' => 'my comment',
],
- ]
+ ],
), $component->options);
$expr = new Expression('(convert_tz(`cache_updated`,_utf8mb4\'GMT\',_utf8mb4\'GB\'))');
$expr->function = 'convert_tz';
@@ -248,7 +248,7 @@ public function testParseKeyExpressionWithOptions(): void
'KEY `updated_tz_ind2`'
. ' ((convert_tz(`cache_updated`,_utf8mb4\'GMT\',_utf8mb4\'GB\')))'
. ' COMMENT \'my comment\'',
- $component->build()
+ $component->build(),
);
}
@@ -259,13 +259,13 @@ public function testParseKeyExpressionWithOptionsError(): void
$parser,
$this->getTokensList(
'KEY `updated_tz_ind2` (()convert_tz(`cache_updated`,_utf8mb4\'GMT\',_utf8mb4\'GB\')))'
- . ' COMMENT \'my comment\','
- )
+ . ' COMMENT \'my comment\',',
+ ),
);
$this->assertEquals('KEY', $component->type);
$this->assertEquals('updated_tz_ind2', $component->name);
$this->assertEquals(new OptionsArray(
- []
+ [],
), $component->options);
$t = new Token('convert_tz', TokenType::Keyword, 33);
$t->position = 25;
@@ -273,7 +273,7 @@ public function testParseKeyExpressionWithOptionsError(): void
$this->assertEquals([
new ParserException(
'Unexpected token.',
- $t
+ $t,
),
], $parser->errors);
$expr = new Expression('(convert_tz(`cache_updated`,_utf8mb4\'GMT\',_utf8mb4\'GB\'))');
@@ -282,7 +282,7 @@ public function testParseKeyExpressionWithOptionsError(): void
$this->assertSame([], $component->columns);
$this->assertSame(
'KEY `updated_tz_ind2` (()(`cache_updated`,_utf8mb4\'GMT\',_utf8mb4\'GB\')) ',
- $component->build()
+ $component->build(),
);
}
@@ -297,8 +297,8 @@ public function testParseKeyOneExpressionWithOptions(): void
. '(convert_tz(`cache_updated`,_utf8mb4\'GMT\',_utf8mb4\'GB\')), '
. '(convert_tz(`cache_updated`,_utf8mb4\'GMT\',_utf8mb4\'FR\'))'
. ')'
- . ' COMMENT \'my comment\','
- )
+ . ' COMMENT \'my comment\',',
+ ),
);
$this->assertEquals('KEY', $component->type);
$this->assertEquals('updated_tz_ind2', $component->name);
@@ -310,12 +310,12 @@ public function testParseKeyOneExpressionWithOptions(): void
'expr' => '\'my comment\'',
'value' => 'my comment',
],
- ]
+ ],
), $component->options);
$this->assertSame([], $parser->errors);
$expr = new Expression(
'(convert_tz(`cache_updated`,_utf8mb4\'GMT\',_utf8mb4\'GB\')),'
- . ' (convert_tz(`cache_updated`,_utf8mb4\'GMT\',_utf8mb4\'FR\'))'
+ . ' (convert_tz(`cache_updated`,_utf8mb4\'GMT\',_utf8mb4\'FR\'))',
);
$expr->function = 'convert_tz';
$this->assertEquals($expr, $component->expr);
@@ -324,7 +324,7 @@ public function testParseKeyOneExpressionWithOptions(): void
'KEY `updated_tz_ind2` ((convert_tz(`cache_updated`,_utf8mb4\'GMT\',_utf8mb4\'GB\')),'
. ' (convert_tz(`cache_updated`,_utf8mb4\'GMT\',_utf8mb4\'FR\'))'
. ') COMMENT \'my comment\'',
- $component->build()
+ $component->build(),
);
}
@@ -340,8 +340,8 @@ public function testParseKeyMultipleExpressionsWithOptions(): void
. '(convert_tz(`cache_updated`,_utf8mb4\'GMT\',_utf8mb4\'FR\')), '
. '(convert_tz(`cache_updated`,_utf8mb4\'GMT\',_utf8mb4\'RU\'))'
. ')'
- . ' COMMENT \'my comment\','
- )
+ . ' COMMENT \'my comment\',',
+ ),
);
$this->assertEquals('KEY', $component->type);
$this->assertEquals('updated_tz_ind2', $component->name);
@@ -353,12 +353,12 @@ public function testParseKeyMultipleExpressionsWithOptions(): void
'expr' => '\'my comment\'',
'value' => 'my comment',
],
- ]
+ ],
), $component->options);
$expr = new Expression(
'(convert_tz(`cache_updated`,_utf8mb4\'GMT\',_utf8mb4\'GB\')),'
. ' (convert_tz(`cache_updated`,_utf8mb4\'GMT\',_utf8mb4\'FR\')),'
- . ' (convert_tz(`cache_updated`,_utf8mb4\'GMT\',_utf8mb4\'RU\'))'
+ . ' (convert_tz(`cache_updated`,_utf8mb4\'GMT\',_utf8mb4\'RU\'))',
);
$expr->function = 'convert_tz';
$this->assertEquals($expr, $component->expr);
@@ -369,7 +369,7 @@ public function testParseKeyMultipleExpressionsWithOptions(): void
. ' (convert_tz(`cache_updated`,_utf8mb4\'GMT\',_utf8mb4\'FR\')),'
. ' (convert_tz(`cache_updated`,_utf8mb4\'GMT\',_utf8mb4\'RU\'))'
. ') COMMENT \'my comment\'',
- $component->build()
+ $component->build(),
);
}
}
diff --git a/tests/Components/LimitTest.php b/tests/Components/LimitTest.php
index 2f6baa252..2d4d533c5 100644
--- a/tests/Components/LimitTest.php
+++ b/tests/Components/LimitTest.php
@@ -28,9 +28,7 @@ public function testParse(string $test): void
$this->runParserTest($test);
}
- /**
- * @return string[][]
- */
+ /** @return string[][] */
public static function parseProvider(): array
{
return [
diff --git a/tests/Components/LockExpressionTest.php b/tests/Components/LockExpressionTest.php
index e34e3ae2b..633cca054 100644
--- a/tests/Components/LockExpressionTest.php
+++ b/tests/Components/LockExpressionTest.php
@@ -37,9 +37,7 @@ public function testParseErr(string $expr, string $error): void
$this->assertEquals($errors[0][0], $error);
}
- /**
- * @return string[][]
- */
+ /** @return string[][] */
public static function parseErrProvider(): array
{
return [
@@ -66,7 +64,7 @@ public function testBuildAll(): void
];
$this->assertEquals(
LockExpression::buildAll($component),
- 'table1 AS `t1` READ LOCAL, table2 LOW_PRIORITY WRITE'
+ 'table1 AS `t1` READ LOCAL, table2 LOW_PRIORITY WRITE',
);
}
}
diff --git a/tests/Components/OptionsArrayTest.php b/tests/Components/OptionsArrayTest.php
index daed0ac23..000b1ab4f 100644
--- a/tests/Components/OptionsArrayTest.php
+++ b/tests/Components/OptionsArrayTest.php
@@ -22,7 +22,7 @@ public function testParse(): void
'var',
],
'C' => 3,
- ]
+ ],
);
$this->assertEquals(
[
@@ -35,7 +35,7 @@ public function testParse(): void
],
3 => 'C',
],
- $component->options
+ $component->options,
);
}
@@ -54,7 +54,7 @@ public function testParseExpr(): void
2,
'var',
],
- ]
+ ],
);
$this->assertEquals('(3 + 5)', (string) $component->has('SUM', true));
$this->assertEquals('8', $component->has('RESULT'));
@@ -72,7 +72,7 @@ public function testHas(): void
'var',
],
'C' => 3,
- ]
+ ],
);
$this->assertTrue($component->has('A'));
$this->assertEquals('test', $component->has('B'));
@@ -99,7 +99,7 @@ public function testRemove(): void
'var',
],
'C' => 3,
- ]
+ ],
);
$this->assertEquals('test', $component->has('B'));
$component->remove('B');
@@ -124,11 +124,11 @@ public function testBuild(): void
'value' => '42',
'equals' => true,
],
- ]
+ ],
);
$this->assertEquals(
$component->build(),
- 'ALL SQL_CALC_FOUND_ROWS MAX_STATEMENT_TIME=42'
+ 'ALL SQL_CALC_FOUND_ROWS MAX_STATEMENT_TIME=42',
);
}
}
diff --git a/tests/Components/OrderKeywordTest.php b/tests/Components/OrderKeywordTest.php
index 2a59d64e7..ec394bdb7 100644
--- a/tests/Components/OrderKeywordTest.php
+++ b/tests/Components/OrderKeywordTest.php
@@ -17,9 +17,9 @@ public function testBuildAll(): void
[
new OrderKeyword(new Expression('a'), 'ASC'),
new OrderKeyword(new Expression('b'), 'DESC'),
- ]
+ ],
),
- 'a ASC, b DESC'
+ 'a ASC, b DESC',
);
}
}
diff --git a/tests/Components/ParameterDefinitionTest.php b/tests/Components/ParameterDefinitionTest.php
index a10fd9fe5..c73098891 100644
--- a/tests/Components/ParameterDefinitionTest.php
+++ b/tests/Components/ParameterDefinitionTest.php
@@ -14,7 +14,7 @@ public function testParse(): void
{
$component = ParameterDefinition::parse(
new Parser(),
- $this->getTokensList('(a INT, b INT')
+ $this->getTokensList('(a INT, b INT'),
);
$this->assertEquals('a', $component[0]->name);
$this->assertEquals('b', $component[1]->name);
@@ -25,7 +25,7 @@ public function testParseComplex(): void
$parser = new Parser();
$component = ParameterDefinition::parse(
$parser,
- $this->getTokensList('CREATE DEFINER=`root`@`%` PROCEDURE `foo`( $bar int )')
+ $this->getTokensList('CREATE DEFINER=`root`@`%` PROCEDURE `foo`( $bar int )'),
);
$this->assertEquals('$bar', $component[0]->name);
}
diff --git a/tests/Components/PartitionDefinitionTest.php b/tests/Components/PartitionDefinitionTest.php
index 9bd73e63d..128c7f85b 100644
--- a/tests/Components/PartitionDefinitionTest.php
+++ b/tests/Components/PartitionDefinitionTest.php
@@ -14,7 +14,7 @@ public function testParse(): void
{
$component = PartitionDefinition::parse(
new Parser(),
- $this->getTokensList('PARTITION p0 VALUES LESS THAN(1990)')
+ $this->getTokensList('PARTITION p0 VALUES LESS THAN(1990)'),
);
$this->assertFalse($component->isSubpartition);
$this->assertEquals('p0', $component->name);
@@ -26,7 +26,7 @@ public function testParseNameWithUnderscore(): void
{
$component = PartitionDefinition::parse(
new Parser(),
- $this->getTokensList('PARTITION 2017_12 VALUES LESS THAN (\'2018-01-01 00:00:00\') ENGINE = MyISAM')
+ $this->getTokensList('PARTITION 2017_12 VALUES LESS THAN (\'2018-01-01 00:00:00\') ENGINE = MyISAM'),
);
$this->assertFalse($component->isSubpartition);
$this->assertEquals('2017_12', $component->name);
diff --git a/tests/Lexer/ContextTest.php b/tests/Lexer/ContextTest.php
index 95ba7b57f..ec20e6848 100644
--- a/tests/Lexer/ContextTest.php
+++ b/tests/Lexer/ContextTest.php
@@ -95,9 +95,7 @@ public function testLoadAll(string $context): void
Context::load('');
}
- /**
- * @return string[][]
- */
+ /** @return string[][] */
public static function contextNamesProvider(): array
{
return [
@@ -119,9 +117,7 @@ public function testLoadError(): void
$this->assertFalse(Context::load('Foo'));
}
- /**
- * @param int|string $mode
- */
+ /** @param int|string $mode */
#[DataProvider('providerForTestMode')]
public function testMode($mode, int $expected): void
{
@@ -176,11 +172,11 @@ public static function providerForTestMode(): array
public function testModeWithCombinedModes(): void
{
Context::setMode(
- Context::SQL_MODE_REAL_AS_FLOAT | Context::SQL_MODE_ANSI_QUOTES | Context::SQL_MODE_IGNORE_SPACE
+ Context::SQL_MODE_REAL_AS_FLOAT | Context::SQL_MODE_ANSI_QUOTES | Context::SQL_MODE_IGNORE_SPACE,
);
$this->assertSame(
Context::SQL_MODE_REAL_AS_FLOAT | Context::SQL_MODE_ANSI_QUOTES | Context::SQL_MODE_IGNORE_SPACE,
- Context::getMode()
+ Context::getMode(),
);
$this->assertTrue(Context::hasMode(Context::SQL_MODE_REAL_AS_FLOAT | Context::SQL_MODE_IGNORE_SPACE));
$this->assertTrue(Context::hasMode(Context::SQL_MODE_ANSI_QUOTES));
@@ -199,7 +195,7 @@ public function testModeWithString(): void
Context::setMode('REAL_AS_FLOAT,ANSI_QUOTES,IGNORE_SPACE');
$this->assertSame(
Context::SQL_MODE_REAL_AS_FLOAT | Context::SQL_MODE_ANSI_QUOTES | Context::SQL_MODE_IGNORE_SPACE,
- Context::getMode()
+ Context::getMode(),
);
$this->assertTrue(Context::hasMode(Context::SQL_MODE_REAL_AS_FLOAT | Context::SQL_MODE_IGNORE_SPACE));
$this->assertTrue(Context::hasMode(Context::SQL_MODE_ANSI_QUOTES));
diff --git a/tests/Lexer/IsMethodsTest.php b/tests/Lexer/IsMethodsTest.php
index afc8948a1..27dee015c 100644
--- a/tests/Lexer/IsMethodsTest.php
+++ b/tests/Lexer/IsMethodsTest.php
@@ -18,11 +18,11 @@ public function testIsKeyword(): void
$this->assertEquals(
1 | Token::FLAG_KEYWORD_RESERVED | Token::FLAG_KEYWORD_COMPOSED | Token::FLAG_KEYWORD_KEY,
- Context::isKeyword('PRIMARY KEY')
+ Context::isKeyword('PRIMARY KEY'),
);
$this->assertEquals(
1 | Token::FLAG_KEYWORD_RESERVED | Token::FLAG_KEYWORD_COMPOSED,
- Context::isKeyword('CHARACTER SET')
+ Context::isKeyword('CHARACTER SET'),
);
$this->assertEquals(1 | Token::FLAG_KEYWORD_RESERVED, Context::isKeyword('FROM', true));
diff --git a/tests/Lexer/LexerTest.php b/tests/Lexer/LexerTest.php
index 61ab2b826..066e16e53 100644
--- a/tests/Lexer/LexerTest.php
+++ b/tests/Lexer/LexerTest.php
@@ -26,7 +26,7 @@ public function testError(): void
sprintf('%2$s #%1$d', 2, 'error'),
'bar',
3,
- 4
+ 4,
);
$this->assertEquals(
@@ -34,7 +34,7 @@ public function testError(): void
[
new LexerException('error #1', 'foo', 1, 2),
new LexerException('error #2', 'bar', 3, 4),
- ]
+ ],
);
}
@@ -54,9 +54,7 @@ public function testLex(string $test): void
$this->runParserTest($test);
}
- /**
- * @return string[][]
- */
+ /** @return string[][] */
public static function lexProvider(): array
{
return [
diff --git a/tests/Lexer/TokensListTest.php b/tests/Lexer/TokensListTest.php
index 16dcedeea..0fa6627a0 100644
--- a/tests/Lexer/TokensListTest.php
+++ b/tests/Lexer/TokensListTest.php
@@ -26,6 +26,7 @@ class TokensListTest extends TestCase
public function setUp(): void
{
parent::setUp();
+
$this->tokens = [
new Token('SELECT', TokenType::Keyword),
new Token(' ', TokenType::Whitespace),
@@ -111,11 +112,11 @@ public function testGetNextOfTypeAndFlag(): void
$list = new TokensList($this->tokens);
$this->assertEquals($this->tokens[4], $list->getNextOfTypeAndFlag(
TokenType::Keyword,
- Token::FLAG_KEYWORD_RESERVED
+ Token::FLAG_KEYWORD_RESERVED,
));
$this->assertEquals($this->tokens[8], $list->getNextOfTypeAndFlag(
TokenType::Keyword,
- Token::FLAG_KEYWORD_RESERVED
+ Token::FLAG_KEYWORD_RESERVED,
));
$this->assertNull($list->getNextOfTypeAndFlag(TokenType::Keyword, Token::FLAG_KEYWORD_RESERVED));
}
diff --git a/tests/Misc/BugsTest.php b/tests/Misc/BugsTest.php
index dd772f60d..c489eea93 100644
--- a/tests/Misc/BugsTest.php
+++ b/tests/Misc/BugsTest.php
@@ -15,9 +15,7 @@ public function testBug(string $test): void
$this->runParserTest($test);
}
- /**
- * @return string[][]
- */
+ /** @return string[][] */
public static function bugProvider(): array
{
return [
diff --git a/tests/Misc/ParameterTest.php b/tests/Misc/ParameterTest.php
index f70f6dedf..773dba6e2 100644
--- a/tests/Misc/ParameterTest.php
+++ b/tests/Misc/ParameterTest.php
@@ -15,9 +15,7 @@ public function testParameter(string $test): void
$this->runParserTest($test);
}
- /**
- * @return string[][]
- */
+ /** @return string[][] */
public static function parameterProvider(): array
{
return [
diff --git a/tests/Parser/AlterStatementTest.php b/tests/Parser/AlterStatementTest.php
index 7659bd7b6..7d1029420 100644
--- a/tests/Parser/AlterStatementTest.php
+++ b/tests/Parser/AlterStatementTest.php
@@ -15,9 +15,7 @@ public function testAlter(string $test): void
$this->runParserTest($test);
}
- /**
- * @return string[][]
- */
+ /** @return string[][] */
public static function alterProvider(): array
{
return [
diff --git a/tests/Parser/AnalyzeStatementTest.php b/tests/Parser/AnalyzeStatementTest.php
index d9935ac1a..dd17c976a 100644
--- a/tests/Parser/AnalyzeStatementTest.php
+++ b/tests/Parser/AnalyzeStatementTest.php
@@ -15,9 +15,7 @@ public function testAnalyze(string $test): void
$this->runParserTest($test);
}
- /**
- * @return string[][]
- */
+ /** @return string[][] */
public static function analyzeProvider(): array
{
return [
diff --git a/tests/Parser/CallStatementTest.php b/tests/Parser/CallStatementTest.php
index 788849228..8dd87cf65 100644
--- a/tests/Parser/CallStatementTest.php
+++ b/tests/Parser/CallStatementTest.php
@@ -15,9 +15,7 @@ public function testCall(string $test): void
$this->runParserTest($test);
}
- /**
- * @return string[][]
- */
+ /** @return string[][] */
public static function callProvider(): array
{
return [
diff --git a/tests/Parser/CreateStatementTest.php b/tests/Parser/CreateStatementTest.php
index 06f20f956..45356fc03 100644
--- a/tests/Parser/CreateStatementTest.php
+++ b/tests/Parser/CreateStatementTest.php
@@ -15,9 +15,7 @@ public function testCreate(string $test): void
$this->runParserTest($test);
}
- /**
- * @return string[][]
- */
+ /** @return string[][] */
public static function createProvider(): array
{
return [
diff --git a/tests/Parser/DeleteStatementTest.php b/tests/Parser/DeleteStatementTest.php
index e80da9377..c9cab06fb 100644
--- a/tests/Parser/DeleteStatementTest.php
+++ b/tests/Parser/DeleteStatementTest.php
@@ -15,9 +15,7 @@ public function testDelete(string $test): void
$this->runParserTest($test);
}
- /**
- * @return string[][]
- */
+ /** @return string[][] */
public static function deleteProvider(): array
{
return [
diff --git a/tests/Parser/DropStatementTest.php b/tests/Parser/DropStatementTest.php
index 82afa42e8..5685c39d0 100644
--- a/tests/Parser/DropStatementTest.php
+++ b/tests/Parser/DropStatementTest.php
@@ -15,9 +15,7 @@ public function testDrop(string $test): void
$this->runParserTest($test);
}
- /**
- * @return string[][]
- */
+ /** @return string[][] */
public static function dropProvider(): array
{
return [
diff --git a/tests/Parser/ExplainStatementTest.php b/tests/Parser/ExplainStatementTest.php
index be68cbf98..26552a4ac 100644
--- a/tests/Parser/ExplainStatementTest.php
+++ b/tests/Parser/ExplainStatementTest.php
@@ -15,9 +15,7 @@ public function testExplain(string $test): void
$this->runParserTest($test);
}
- /**
- * @return string[][]
- */
+ /** @return string[][] */
public static function explainProvider(): array
{
return [
diff --git a/tests/Parser/InsertStatementTest.php b/tests/Parser/InsertStatementTest.php
index 17e22478d..3a285c9b3 100644
--- a/tests/Parser/InsertStatementTest.php
+++ b/tests/Parser/InsertStatementTest.php
@@ -15,9 +15,7 @@ public function testInsert(string $test): void
$this->runParserTest($test);
}
- /**
- * @return string[][]
- */
+ /** @return string[][] */
public static function insertProvider(): array
{
return [
diff --git a/tests/Parser/LoadStatementTest.php b/tests/Parser/LoadStatementTest.php
index 66d2c2a82..027e22c25 100644
--- a/tests/Parser/LoadStatementTest.php
+++ b/tests/Parser/LoadStatementTest.php
@@ -24,9 +24,7 @@ public function testLoad(string $test): void
$this->runParserTest($test);
}
- /**
- * @return string[][]
- */
+ /** @return string[][] */
public static function loadProvider(): array
{
return [
diff --git a/tests/Parser/LockStatementTest.php b/tests/Parser/LockStatementTest.php
index 0240cc878..30dce522f 100644
--- a/tests/Parser/LockStatementTest.php
+++ b/tests/Parser/LockStatementTest.php
@@ -15,9 +15,7 @@ public function testLock(string $test): void
$this->runParserTest($test);
}
- /**
- * @return string[][]
- */
+ /** @return string[][] */
public static function lockProvider(): array
{
return [
diff --git a/tests/Parser/ParserLongExportsTest.php b/tests/Parser/ParserLongExportsTest.php
index 12c9c14b3..046b66692 100644
--- a/tests/Parser/ParserLongExportsTest.php
+++ b/tests/Parser/ParserLongExportsTest.php
@@ -107,9 +107,7 @@ public function testParseExport(string $test): void
$this->runParserTest($test);
}
- /**
- * @return string[][]
- */
+ /** @return string[][] */
public static function exportFileProvider(): array
{
return [
diff --git a/tests/Parser/ParserTest.php b/tests/Parser/ParserTest.php
index 79f142be9..cf0cbf344 100644
--- a/tests/Parser/ParserTest.php
+++ b/tests/Parser/ParserTest.php
@@ -23,9 +23,7 @@ public function testParse(string $test): void
$this->runParserTest($test);
}
- /**
- * @return string[][]
- */
+ /** @return string[][] */
public static function parseProvider(): array
{
return [
@@ -40,7 +38,7 @@ public function testUnrecognizedStatement(): void
$parser = new Parser('SELECT 1; FROM');
$this->assertEquals(
'Unrecognized statement type.',
- $parser->errors[0]->getMessage()
+ $parser->errors[0]->getMessage(),
);
}
@@ -49,7 +47,7 @@ public function testUnrecognizedKeyword(): void
$parser = new Parser('SELECT 1 FROM foo PARTITION(bar, baz) AS');
$this->assertEquals(
'Unrecognized keyword.',
- $parser->errors[0]->getMessage()
+ $parser->errors[0]->getMessage(),
);
}
@@ -67,7 +65,7 @@ public function testError(): void
[
new ParserException('error #1', new Token('foo'), 1),
new ParserException('error #2', new Token('bar'), 2),
- ]
+ ],
);
}
diff --git a/tests/Parser/PurgeStatementTest.php b/tests/Parser/PurgeStatementTest.php
index b54945ce3..703772e30 100644
--- a/tests/Parser/PurgeStatementTest.php
+++ b/tests/Parser/PurgeStatementTest.php
@@ -15,9 +15,7 @@ public function testPurge(string $test): void
$this->runParserTest($test);
}
- /**
- * @return string[][]
- */
+ /** @return string[][] */
public static function purgeProvider(): array
{
return [
diff --git a/tests/Parser/RenameStatementTest.php b/tests/Parser/RenameStatementTest.php
index 7fa77051c..5ba90ff4c 100644
--- a/tests/Parser/RenameStatementTest.php
+++ b/tests/Parser/RenameStatementTest.php
@@ -15,9 +15,7 @@ public function testRename(string $test): void
$this->runParserTest($test);
}
- /**
- * @return string[][]
- */
+ /** @return string[][] */
public static function renameProvider(): array
{
return [
diff --git a/tests/Parser/ReplaceStatementTest.php b/tests/Parser/ReplaceStatementTest.php
index 10bc1a436..4d2a9d8a6 100644
--- a/tests/Parser/ReplaceStatementTest.php
+++ b/tests/Parser/ReplaceStatementTest.php
@@ -15,9 +15,7 @@ public function testReplace(string $test): void
$this->runParserTest($test);
}
- /**
- * @return string[][]
- */
+ /** @return string[][] */
public static function replaceProvider(): array
{
return [
diff --git a/tests/Parser/RestoreStatementTest.php b/tests/Parser/RestoreStatementTest.php
index 237aac84d..02f906ce0 100644
--- a/tests/Parser/RestoreStatementTest.php
+++ b/tests/Parser/RestoreStatementTest.php
@@ -15,9 +15,7 @@ public function testRestore(string $test): void
$this->runParserTest($test);
}
- /**
- * @return string[][]
- */
+ /** @return string[][] */
public static function restoreProvider(): array
{
return [
diff --git a/tests/Parser/SelectStatementTest.php b/tests/Parser/SelectStatementTest.php
index 2297a4a19..87754b73b 100644
--- a/tests/Parser/SelectStatementTest.php
+++ b/tests/Parser/SelectStatementTest.php
@@ -24,9 +24,7 @@ public function testSelect(string $test): void
$this->runParserTest($test);
}
- /**
- * @return string[][]
- */
+ /** @return string[][] */
public static function selectProvider(): array
{
return [
diff --git a/tests/Parser/SetStatementTest.php b/tests/Parser/SetStatementTest.php
index 9614d16dd..32896e8e9 100644
--- a/tests/Parser/SetStatementTest.php
+++ b/tests/Parser/SetStatementTest.php
@@ -15,9 +15,7 @@ public function testSet(string $test): void
$this->runParserTest($test);
}
- /**
- * @return string[][]
- */
+ /** @return string[][] */
public static function setProvider(): array
{
return [
diff --git a/tests/Parser/TransactionStatementTest.php b/tests/Parser/TransactionStatementTest.php
index ce1ce6cfe..86ba3dd4c 100644
--- a/tests/Parser/TransactionStatementTest.php
+++ b/tests/Parser/TransactionStatementTest.php
@@ -17,7 +17,7 @@ public function testBuildWithoutEnd(): void
$stmt = $parser->statements[0];
$this->assertEquals(
'START TRANSACTION;SET time_zone = "+00:00";',
- $stmt->build()
+ $stmt->build(),
);
}
@@ -27,9 +27,7 @@ public function testTransaction(string $test): void
$this->runParserTest($test);
}
- /**
- * @return string[][]
- */
+ /** @return string[][] */
public static function transactionProvider(): array
{
return [
diff --git a/tests/Parser/UpdateStatementTest.php b/tests/Parser/UpdateStatementTest.php
index fa00ff081..4a1edce8e 100644
--- a/tests/Parser/UpdateStatementTest.php
+++ b/tests/Parser/UpdateStatementTest.php
@@ -15,9 +15,7 @@ public function testUpdate(string $test): void
$this->runParserTest($test);
}
- /**
- * @return string[][]
- */
+ /** @return string[][] */
public static function updateProvider(): array
{
return [
diff --git a/tests/Parser/WithStatementTest.php b/tests/Parser/WithStatementTest.php
index c4404737f..267e29625 100644
--- a/tests/Parser/WithStatementTest.php
+++ b/tests/Parser/WithStatementTest.php
@@ -18,9 +18,7 @@ public function testParse(string $test): void
$this->runParserTest($test);
}
- /**
- * @return string[][]
- */
+ /** @return string[][] */
public static function parseWith(): array
{
return [
diff --git a/tests/TestCase.php b/tests/TestCase.php
index fc196ae24..45f14c31a 100644
--- a/tests/TestCase.php
+++ b/tests/TestCase.php
@@ -26,13 +26,12 @@ abstract class TestCase extends BaseTestCase
{
public function setUp(): void
{
- global $lang;
// This line makes sure the test suite uses English so we can assert
// on the error messages, if it is not here you will need to use
// LC_ALL=C ./vendor/bin/phpunit
// Users can have French language as default on their OS
// That would make the assertions fail
- $lang = 'en';
+ $GLOBALS['lang'] = 'en';
Context::load();
}
diff --git a/tests/Utils/BufferedQueryTest.php b/tests/Utils/BufferedQueryTest.php
index cd4706cc4..022bb4b12 100644
--- a/tests/Utils/BufferedQueryTest.php
+++ b/tests/Utils/BufferedQueryTest.php
@@ -24,7 +24,7 @@ public function testExtract(
string $query,
int $chunkSize,
array $options,
- array $expected
+ array $expected,
): void {
$chunks = str_split($query, $chunkSize);
$count = count($chunks);
diff --git a/tests/Utils/CLITest.php b/tests/Utils/CLITest.php
index c6ea252ad..6f77ce563 100644
--- a/tests/Utils/CLITest.php
+++ b/tests/Utils/CLITest.php
@@ -15,9 +15,7 @@
class CLITest extends TestCase
{
- /**
- * @param array|false $getopt
- */
+ /** @param array|false $getopt */
private function getCLI($getopt): CLI
{
$cli = $this->createPartialMock(CLI::class, ['getopt']);
@@ -26,9 +24,7 @@ private function getCLI($getopt): CLI
return $cli;
}
- /**
- * @param array|false $getopt
- */
+ /** @param array|false $getopt */
private function getCLIStdIn(string $input, $getopt): CLI
{
$cli = $this->createPartialMock(CLI::class, ['getopt', 'readStdin']);
@@ -48,13 +44,11 @@ public function testGetopt(): void
$cli = new CLI();
$this->assertEquals(
$cli->getopt('', []),
- []
+ [],
);
}
- /**
- * @param array|false $getopt
- */
+ /** @param array|false $getopt */
#[DataProvider('highlightParamsProvider')]
public function testRunHighlight($getopt, string $output, int $result): void
{
@@ -126,9 +120,7 @@ public static function highlightParamsProvider(): array
];
}
- /**
- * @param array|false $getopt
- */
+ /** @param array|false $getopt */
#[DataProvider('highlightParamsStdInProvider')]
public function testRunHighlightStdIn(string $input, $getopt, string $output, int $result): void
{
@@ -193,9 +185,7 @@ public static function highlightParamsStdInProvider(): array
];
}
- /**
- * @param array|false $getopt
- */
+ /** @param array|false $getopt */
#[DataProvider('lintParamsStdInProvider')]
public function testRunLintFromStdIn(string $input, $getopt, string $output, int $result): void
{
@@ -257,9 +247,7 @@ public static function lintParamsStdInProvider(): array
];
}
- /**
- * @param array|false $getopt
- */
+ /** @param array|false $getopt */
#[DataProvider('lintParamsProvider')]
public function testRunLint($getopt, string $output, int $result): void
{
@@ -323,9 +311,7 @@ public static function lintParamsProvider(): array
];
}
- /**
- * @param array|false $getopt
- */
+ /** @param array|false $getopt */
#[DataProvider('tokenizeParamsProvider')]
public function testRunTokenize($getopt, string $output, int $result): void
{
@@ -377,9 +363,7 @@ public static function tokenizeParamsProvider(): array
];
}
- /**
- * @param array|false $getopt
- */
+ /** @param array|false $getopt */
#[DataProvider('tokenizeParamsStdInProvider')]
public function testRunTokenizeStdIn(string $input, $getopt, string $output, int $result): void
{
diff --git a/tests/Utils/ErrorTest.php b/tests/Utils/ErrorTest.php
index dce85da1f..cf2acbe33 100644
--- a/tests/Utils/ErrorTest.php
+++ b/tests/Utils/ErrorTest.php
@@ -30,7 +30,7 @@ public function testGet(): void
17,
],
],
- Error::get([$lexer, $parser])
+ Error::get([$lexer, $parser]),
);
}
@@ -38,14 +38,14 @@ public function testFormat(): void
{
$this->assertEquals(
['#1: error msg (near "token" at position 100)'],
- Error::format([['error msg', 42, 'token', 100]])
+ Error::format([['error msg', 42, 'token', 100]]),
);
$this->assertEquals(
[
'#1: error msg (near "token" at position 100)',
'#2: error msg (near "token" at position 200)',
],
- Error::format([['error msg', 42, 'token', 100], ['error msg', 42, 'token', 200]])
+ Error::format([['error msg', 42, 'token', 100], ['error msg', 42, 'token', 200]]),
);
}
}
diff --git a/tests/Utils/FormatterTest.php b/tests/Utils/FormatterTest.php
index 149a0ecd3..e3247bd92 100644
--- a/tests/Utils/FormatterTest.php
+++ b/tests/Utils/FormatterTest.php
@@ -243,9 +243,7 @@ public static function mergeFormatsProvider(): array
];
}
- /**
- * @param array $options
- */
+ /** @param array $options */
#[DataProvider('formatQueriesProviders')]
public function testFormat(string $query, string $text, string $cli, string $html, array $options = []): void
{
@@ -253,21 +251,21 @@ public function testFormat(string $query, string $text, string $cli, string $htm
$this->assertEquals(
$text,
Formatter::format($query, ['type' => 'text'] + $options),
- 'Text formatting failed.'
+ 'Text formatting failed.',
);
// Test CLI format
$this->assertEquals(
$cli,
Formatter::format($query, ['type' => 'cli'] + $options),
- 'CLI formatting failed.'
+ 'CLI formatting failed.',
);
// Test HTML format
$this->assertEquals(
$html,
Formatter::format($query, ['type' => 'html'] + $options),
- 'HTML formatting failed.'
+ 'HTML formatting failed.',
);
}
diff --git a/tests/Utils/QueryTest.php b/tests/Utils/QueryTest.php
index 1c8b5deab..3650a97df 100644
--- a/tests/Utils/QueryTest.php
+++ b/tests/Utils/QueryTest.php
@@ -11,9 +11,7 @@
use function array_merge;
-/**
- * @psalm-import-type QueryFlagsType from Query
- */
+/** @psalm-import-type QueryFlagsType from Query */
class QueryTest extends TestCase
{
/**
@@ -310,7 +308,7 @@ public function testGetAll(): void
'select_from' => false,
'union' => false,
],
- Query::getAll('')
+ Query::getAll(''),
);
$query = 'SELECT *, actor.actor_id, sakila2.film.*
@@ -333,9 +331,9 @@ public function testGetAll(): void
'sakila2',
],
],
- ]
+ ],
),
- Query::getAll($query)
+ Query::getAll($query),
);
$query = 'SELECT * FROM sakila.actor, film';
@@ -357,9 +355,9 @@ public function testGetAll(): void
null,
],
],
- ]
+ ],
),
- Query::getAll($query)
+ Query::getAll($query),
);
$query = 'SELECT a.actor_id FROM sakila.actor AS a, film';
@@ -377,9 +375,9 @@ public function testGetAll(): void
'sakila',
],
],
- ]
+ ],
),
- Query::getAll($query)
+ Query::getAll($query),
);
$query = 'SELECT CASE WHEN 2 IS NULL THEN "this is true" ELSE "this is false" END';
@@ -392,22 +390,20 @@ public function testGetAll(): void
'statement' => $parser->statements[0],
'select_expr' => ['CASE WHEN 2 IS NULL THEN "this is true" ELSE "this is false" END'],
'select_tables' => [],
- ]
+ ],
),
- Query::getAll($query)
+ Query::getAll($query),
);
}
- /**
- * @param string[] $expected
- */
+ /** @param string[] $expected */
#[DataProvider('getTablesProvider')]
public function testGetTables(string $query, array $expected): void
{
$parser = new Parser($query);
$this->assertEquals(
$expected,
- Query::getTables($parser->statements[0])
+ Query::getTables($parser->statements[0]),
);
}
@@ -476,7 +472,7 @@ public function testGetClause(): void
'WHERE city_id < 1 /* test */' .
'ORDER BY city_id ASC ' .
'LIMIT 0, 1 ' .
- 'INTO OUTFILE "/dev/null"'
+ 'INTO OUTFILE "/dev/null"',
);
$this->assertEquals(
'0, 1 INTO OUTFILE "/dev/null"',
@@ -484,8 +480,8 @@ public function testGetClause(): void
$parser->statements[0],
$parser->list,
'LIMIT',
- 0
- )
+ 0,
+ ),
);
// Assert it returns all clauses between FROM and LIMIT
$this->assertEquals(
@@ -494,8 +490,8 @@ public function testGetClause(): void
$parser->statements[0],
$parser->list,
'FROM',
- 'LIMIT'
- )
+ 'LIMIT',
+ ),
);
// Assert it returns all clauses between SELECT and LIMIT
$this->assertEquals(
@@ -504,8 +500,8 @@ public function testGetClause(): void
$parser->statements[0],
$parser->list,
'LIMIT',
- 'SELECT'
- )
+ 'SELECT',
+ ),
);
/* Assertion 2 */
@@ -513,31 +509,31 @@ public function testGetClause(): void
'DELETE FROM `renewal` ' .
'WHERE number = "1DB" AND actionDate <= CURRENT_DATE() ' .
'ORDER BY id ASC ' .
- 'LIMIT 1'
+ 'LIMIT 1',
);
$this->assertEquals(
'number = "1DB" AND actionDate <= CURRENT_DATE()',
Query::getClause(
$parser->statements[0],
$parser->list,
- 'WHERE'
- )
+ 'WHERE',
+ ),
);
$this->assertEquals(
'1',
Query::getClause(
$parser->statements[0],
$parser->list,
- 'LIMIT'
- )
+ 'LIMIT',
+ ),
);
$this->assertEquals(
'id ASC',
Query::getClause(
$parser->statements[0],
$parser->list,
- 'ORDER BY'
- )
+ 'ORDER BY',
+ ),
);
/* Assertion 3 */
@@ -545,31 +541,31 @@ public function testGetClause(): void
'UPDATE `renewal` SET `some_column` = 1 ' .
'WHERE number = "1DB" AND actionDate <= CURRENT_DATE() ' .
'ORDER BY id ASC ' .
- 'LIMIT 1'
+ 'LIMIT 1',
);
$this->assertEquals(
'number = "1DB" AND actionDate <= CURRENT_DATE()',
Query::getClause(
$parser->statements[0],
$parser->list,
- 'WHERE'
- )
+ 'WHERE',
+ ),
);
$this->assertEquals(
'1',
Query::getClause(
$parser->statements[0],
$parser->list,
- 'LIMIT'
- )
+ 'LIMIT',
+ ),
);
$this->assertEquals(
'id ASC',
Query::getClause(
$parser->statements[0],
$parser->list,
- 'ORDER BY'
- )
+ 'ORDER BY',
+ ),
);
}
@@ -581,13 +577,13 @@ public function testReplaceClause(): void
Query::replaceClause(
$parser->statements[0],
$parser->list,
- 'WHERE film_id > 0'
- )
+ 'WHERE film_id > 0',
+ ),
);
$parser = new Parser(
'select supplier.city, supplier.id from supplier '
- . 'union select customer.city, customer.id from customer'
+ . 'union select customer.city, customer.id from customer',
);
$this->assertEquals(
'select supplier.city, supplier.id from supplier '
@@ -596,8 +592,8 @@ public function testReplaceClause(): void
Query::replaceClause(
$parser->statements[0],
$parser->list,
- 'ORDER BY city'
- )
+ 'ORDER BY city',
+ ),
);
}
@@ -611,8 +607,8 @@ public function testReplaceClauseOnlyKeyword(): void
$parser->list,
'SELECT SQL_CALC_FOUND_ROWS',
null,
- true
- )
+ true,
+ ),
);
}
@@ -625,8 +621,8 @@ public function testReplaceNonExistingPart(): void
$parser->statements[0],
$parser->list,
'ORDER BY',
- ''
- )
+ '',
+ ),
);
}
@@ -644,8 +640,8 @@ public function testReplaceClauses(): void
'WHERE',
'WHERE film_id > 0',
],
- ]
- )
+ ],
+ ),
);
$parser = new Parser(
@@ -654,7 +650,7 @@ public function testReplaceClauses(): void
'FROM `city` ' .
'WHERE city_id < 1 ' .
'ORDER BY city_id ASC ' .
- 'LIMIT 0, 1 '
+ 'LIMIT 0, 1 ',
);
$this->assertEquals(
'SELECT c.city_id, c.country_id ' .
@@ -678,8 +674,8 @@ public function testReplaceClauses(): void
'LIMIT',
'LIMIT 0, 10',
],
- ]
- )
+ ],
+ ),
);
}
diff --git a/tests/Utils/RoutineTest.php b/tests/Utils/RoutineTest.php
index d6e0b97d5..80164b81b 100644
--- a/tests/Utils/RoutineTest.php
+++ b/tests/Utils/RoutineTest.php
@@ -11,9 +11,7 @@
class RoutineTest extends TestCase
{
- /**
- * @param string[] $expected
- */
+ /** @param string[] $expected */
#[DataProvider('getReturnTypeProvider')]
public function testGetReturnType(string $def, array $expected): void
{
@@ -94,9 +92,7 @@ public static function getReturnTypeProvider(): array
];
}
- /**
- * @param string[] $expected
- */
+ /** @param string[] $expected */
#[DataProvider('getParameterProvider')]
public function testGetParameter(string $def, array $expected): void
{