diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 75375844..98fb5778 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -27,12 +27,4 @@ src/Contexts/* tests/Tools/templates/* - - - - 4 - - - 4 - diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 3204543c..f0431293 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,24 +1,24 @@ parameters: ignoreErrors: - - message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Components\\\\AlterOperation\\:\\:\\$options \\(PhpMyAdmin\\\\SqlParser\\\\Components\\\\OptionsArray\\) does not accept PhpMyAdmin\\\\SqlParser\\\\Components\\\\OptionsArray\\|null\\.$#" - count: 1 + message: "#^Cannot call method has\\(\\) on PhpMyAdmin\\\\SqlParser\\\\Components\\\\OptionsArray\\|null\\.$#" + count: 2 path: src/Components/AlterOperation.php - - message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Components\\\\DataType\\:\\:\\$name \\(string\\) does not accept string\\|null\\.$#" - count: 1 - path: src/Components/DataType.php + message: "#^Cannot call method remove\\(\\) on PhpMyAdmin\\\\SqlParser\\\\Components\\\\OptionsArray\\|null\\.$#" + count: 3 + path: src/Components/AlterOperation.php - - message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Components\\\\DataType\\:\\:\\$options \\(PhpMyAdmin\\\\SqlParser\\\\Components\\\\OptionsArray\\) does not accept PhpMyAdmin\\\\SqlParser\\\\Components\\\\OptionsArray\\|null\\.$#" + message: "#^Cannot clone PhpMyAdmin\\\\SqlParser\\\\Components\\\\OptionsArray\\|null\\.$#" count: 1 - path: src/Components/DataType.php + path: src/Components/AlterOperation.php - - message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Components\\\\GroupKeyword\\:\\:\\$expr \\(PhpMyAdmin\\\\SqlParser\\\\Components\\\\Expression\\) does not accept PhpMyAdmin\\\\SqlParser\\\\Components\\\\Expression\\|null\\.$#" + message: "#^Parameter \\#1 \\$string of function strtolower expects string, string\\|null given\\.$#" count: 1 - path: src/Components/GroupKeyword.php + path: src/Components/DataType.php - message: "#^Parameter \\#2 \\$string2 of function strcasecmp expects string, mixed given\\.$#" @@ -26,50 +26,10 @@ parameters: path: src/Components/OptionsArray.php - - message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Components\\\\OrderKeyword\\:\\:\\$expr \\(PhpMyAdmin\\\\SqlParser\\\\Components\\\\Expression\\) does not accept PhpMyAdmin\\\\SqlParser\\\\Components\\\\Expression\\|null\\.$#" - count: 1 - path: src/Components/OrderKeyword.php - - - - message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Components\\\\ParameterDefinition\\:\\:\\$inOut \\(string\\) does not accept string\\|null\\.$#" + message: "#^Parameter \\#1 \\$str of static method PhpMyAdmin\\\\SqlParser\\\\Context\\:\\:escape\\(\\) expects string, string\\|null given\\.$#" count: 1 path: src/Components/ParameterDefinition.php - - - message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Components\\\\ParameterDefinition\\:\\:\\$name \\(string\\) does not accept string\\|null\\.$#" - count: 1 - path: src/Components/ParameterDefinition.php - - - - message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Components\\\\ParameterDefinition\\:\\:\\$type \\(PhpMyAdmin\\\\SqlParser\\\\Components\\\\DataType\\) does not accept PhpMyAdmin\\\\SqlParser\\\\Components\\\\DataType\\|null\\.$#" - count: 1 - path: src/Components/ParameterDefinition.php - - - - message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Components\\\\PartitionDefinition\\:\\:\\$options \\(PhpMyAdmin\\\\SqlParser\\\\Components\\\\OptionsArray\\) in empty\\(\\) is not falsy\\.$#" - count: 1 - path: src/Components/PartitionDefinition.php - - - - message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Components\\\\Reference\\:\\:\\$options \\(PhpMyAdmin\\\\SqlParser\\\\Components\\\\OptionsArray\\) does not accept PhpMyAdmin\\\\SqlParser\\\\Components\\\\OptionsArray\\|null\\.$#" - count: 1 - path: src/Components/Reference.php - - - - message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Components\\\\Reference\\:\\:\\$table \\(PhpMyAdmin\\\\SqlParser\\\\Components\\\\Expression\\) does not accept PhpMyAdmin\\\\SqlParser\\\\Components\\\\Expression\\|null\\.$#" - count: 1 - path: src/Components/Reference.php - - - - message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Components\\\\RenameOperation\\:\\:\\$new \\(PhpMyAdmin\\\\SqlParser\\\\Components\\\\Expression\\) does not accept PhpMyAdmin\\\\SqlParser\\\\Components\\\\Expression\\|null\\.$#" - count: 1 - path: src/Components/RenameOperation.php - - - - message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Components\\\\RenameOperation\\:\\:\\$old \\(PhpMyAdmin\\\\SqlParser\\\\Components\\\\Expression\\) does not accept PhpMyAdmin\\\\SqlParser\\\\Components\\\\Expression\\|null\\.$#" - count: 1 - path: src/Components/RenameOperation.php - - message: "#^Static property PhpMyAdmin\\\\SqlParser\\\\Context\\:\\:\\$keywords \\(non\\-empty\\-array\\\\) does not accept default value of type array\\{\\}\\.$#" count: 1 @@ -135,6 +95,21 @@ parameters: count: 1 path: src/Parser.php + - + message: "#^Cannot call method has\\(\\) on PhpMyAdmin\\\\SqlParser\\\\Components\\\\OptionsArray\\|null\\.$#" + count: 2 + path: src/Parsers/AlterOperations.php + + - + message: "#^Cannot call method isEmpty\\(\\) on PhpMyAdmin\\\\SqlParser\\\\Components\\\\OptionsArray\\|null\\.$#" + count: 1 + path: src/Parsers/AlterOperations.php + + - + message: "#^Cannot call method merge\\(\\) on PhpMyAdmin\\\\SqlParser\\\\Components\\\\OptionsArray\\|null\\.$#" + count: 1 + path: src/Parsers/AlterOperations.php + - message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Components\\\\AlterOperation\\:\\:\\$partitions \\(array\\\\|null\\) does not accept array\\\\|PhpMyAdmin\\\\SqlParser\\\\Components\\\\ArrayObj\\.$#" count: 1 @@ -221,19 +196,14 @@ parameters: path: src/Parsers/Expressions.php - - message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Components\\\\FunctionCall\\:\\:\\$parameters \\(PhpMyAdmin\\\\SqlParser\\\\Components\\\\ArrayObj\\|null\\) does not accept array\\\\|PhpMyAdmin\\\\SqlParser\\\\Components\\\\ArrayObj\\.$#" + message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Components\\\\Expression\\:\\:\\$function \\(string\\|null\\) does not accept bool\\|float\\|int\\|string\\.$#" count: 1 - path: src/Parsers/FunctionCalls.php + path: src/Parsers/Expressions.php - - message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Components\\\\GroupKeyword\\:\\:\\$expr \\(PhpMyAdmin\\\\SqlParser\\\\Components\\\\Expression\\) does not accept PhpMyAdmin\\\\SqlParser\\\\Components\\\\Expression\\|null\\.$#" + message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Components\\\\FunctionCall\\:\\:\\$parameters \\(PhpMyAdmin\\\\SqlParser\\\\Components\\\\ArrayObj\\|null\\) does not accept array\\\\|PhpMyAdmin\\\\SqlParser\\\\Components\\\\ArrayObj\\.$#" count: 1 - path: src/Parsers/GroupKeywords.php - - - - message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Components\\\\GroupKeyword\\:\\:\\$expr \\(PhpMyAdmin\\\\SqlParser\\\\Components\\\\Expression\\) in empty\\(\\) is not falsy\\.$#" - count: 2 - path: src/Parsers/GroupKeywords.php + path: src/Parsers/FunctionCalls.php - message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Components\\\\IndexHint\\:\\:\\$type \\(string\\|null\\) does not accept mixed\\.$#" @@ -285,11 +255,6 @@ parameters: count: 1 path: src/Parsers/Limits.php - - - message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Components\\\\LockExpression\\:\\:\\$table \\(PhpMyAdmin\\\\SqlParser\\\\Components\\\\Expression\\) does not accept PhpMyAdmin\\\\SqlParser\\\\Components\\\\Expression\\|null\\.$#" - count: 1 - path: src/Parsers/LockExpressions.php - - message: "#^Cannot access offset 'equals' on mixed\\.$#" count: 1 @@ -336,47 +301,17 @@ parameters: path: src/Parsers/OptionsArrays.php - - message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Components\\\\OrderKeyword\\:\\:\\$expr \\(PhpMyAdmin\\\\SqlParser\\\\Components\\\\Expression\\) does not accept PhpMyAdmin\\\\SqlParser\\\\Components\\\\Expression\\|null\\.$#" - count: 1 - path: src/Parsers/OrderKeywords.php - - - - message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Components\\\\OrderKeyword\\:\\:\\$expr \\(PhpMyAdmin\\\\SqlParser\\\\Components\\\\Expression\\) in empty\\(\\) is not falsy\\.$#" - count: 2 - path: src/Parsers/OrderKeywords.php - - - - message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Components\\\\ParameterDefinition\\:\\:\\$name \\(string\\) does not accept bool\\|float\\|int\\|string\\.$#" + message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Components\\\\ParameterDefinition\\:\\:\\$name \\(string\\|null\\) does not accept bool\\|float\\|int\\|string\\.$#" count: 1 path: src/Parsers/ParameterDefinitions.php - - message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Components\\\\ParameterDefinition\\:\\:\\$name \\(string\\) in isset\\(\\) is not nullable\\.$#" - count: 1 - path: src/Parsers/ParameterDefinitions.php - - - - message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Components\\\\ParameterDefinition\\:\\:\\$type \\(PhpMyAdmin\\\\SqlParser\\\\Components\\\\DataType\\) does not accept PhpMyAdmin\\\\SqlParser\\\\Components\\\\DataType\\|null\\.$#" - count: 1 - path: src/Parsers/ParameterDefinitions.php - - - - message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Components\\\\PartitionDefinition\\:\\:\\$expr \\(PhpMyAdmin\\\\SqlParser\\\\Components\\\\Expression\\|string\\) does not accept PhpMyAdmin\\\\SqlParser\\\\Components\\\\Expression\\|null\\.$#" + message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Components\\\\PartitionDefinition\\:\\:\\$subpartitions \\(array\\\\|null\\) does not accept array\\\\|PhpMyAdmin\\\\SqlParser\\\\Components\\\\ArrayObj\\.$#" count: 1 path: src/Parsers/PartitionDefinitions.php - - message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Components\\\\PartitionDefinition\\:\\:\\$name \\(string\\) does not accept bool\\|float\\|int\\|string\\.$#" - count: 1 - path: src/Parsers/PartitionDefinitions.php - - - - message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Components\\\\PartitionDefinition\\:\\:\\$subpartitions \\(array\\\\) does not accept array\\\\|PhpMyAdmin\\\\SqlParser\\\\Components\\\\ArrayObj\\.$#" - count: 1 - path: src/Parsers/PartitionDefinitions.php - - - - message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Components\\\\PartitionDefinition\\:\\:\\$type \\(string\\) does not accept bool\\|float\\|int\\|string\\.$#" + message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Components\\\\PartitionDefinition\\:\\:\\$type \\(string\\|null\\) does not accept bool\\|float\\|int\\|string\\.$#" count: 1 path: src/Parsers/PartitionDefinitions.php @@ -385,31 +320,6 @@ parameters: count: 1 path: src/Parsers/References.php - - - message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Components\\\\Reference\\:\\:\\$table \\(PhpMyAdmin\\\\SqlParser\\\\Components\\\\Expression\\) does not accept PhpMyAdmin\\\\SqlParser\\\\Components\\\\Expression\\|null\\.$#" - count: 1 - path: src/Parsers/References.php - - - - message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Components\\\\RenameOperation\\:\\:\\$new \\(PhpMyAdmin\\\\SqlParser\\\\Components\\\\Expression\\) does not accept PhpMyAdmin\\\\SqlParser\\\\Components\\\\Expression\\|null\\.$#" - count: 1 - path: src/Parsers/RenameOperations.php - - - - message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Components\\\\RenameOperation\\:\\:\\$new \\(PhpMyAdmin\\\\SqlParser\\\\Components\\\\Expression\\) in empty\\(\\) is not falsy\\.$#" - count: 1 - path: src/Parsers/RenameOperations.php - - - - message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Components\\\\RenameOperation\\:\\:\\$old \\(PhpMyAdmin\\\\SqlParser\\\\Components\\\\Expression\\) does not accept PhpMyAdmin\\\\SqlParser\\\\Components\\\\Expression\\|null\\.$#" - count: 1 - path: src/Parsers/RenameOperations.php - - - - message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Components\\\\RenameOperation\\:\\:\\$old \\(PhpMyAdmin\\\\SqlParser\\\\Components\\\\Expression\\) in empty\\(\\) is not falsy\\.$#" - count: 2 - path: src/Parsers/RenameOperations.php - - message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Components\\\\SetOperation\\:\\:\\$value \\(string\\) does not accept string\\|null\\.$#" count: 1 @@ -840,19 +750,64 @@ parameters: count: 3 path: src/Utils/Routine.php + - + message: "#^Cannot access property \\$name on PhpMyAdmin\\\\SqlParser\\\\Components\\\\DataType\\|null\\.$#" + count: 2 + path: src/Utils/Routine.php + + - + message: "#^Cannot access property \\$options on PhpMyAdmin\\\\SqlParser\\\\Components\\\\DataType\\|null\\.$#" + count: 2 + path: src/Utils/Routine.php + + - + message: "#^Cannot access property \\$options on PhpMyAdmin\\\\SqlParser\\\\Components\\\\OptionsArray\\|null\\.$#" + count: 3 + path: src/Utils/Routine.php + + - + message: "#^Cannot access property \\$parameters on PhpMyAdmin\\\\SqlParser\\\\Components\\\\DataType\\|null\\.$#" + count: 3 + path: src/Utils/Routine.php + - message: "#^Cannot assign new offset to array\\, mixed\\>\\|string\\.$#" count: 1 path: src/Utils/Routine.php + - + message: "#^Method PhpMyAdmin\\\\SqlParser\\\\Utils\\\\Routine\\:\\:getParameter\\(\\) should return array\\ but returns array\\\\.$#" + count: 1 + path: src/Utils/Routine.php + + - + message: "#^Method PhpMyAdmin\\\\SqlParser\\\\Utils\\\\Routine\\:\\:getReturnType\\(\\) should return array\\ but returns array\\\\.$#" + count: 1 + path: src/Utils/Routine.php + - message: "#^Parameter \\#2 \\$array of function implode expects array\\|null, array\\, mixed\\>\\|string given\\.$#" count: 1 path: src/Utils/Routine.php + - + message: "#^Cannot access property \\$database on PhpMyAdmin\\\\SqlParser\\\\Components\\\\Expression\\|null\\.$#" + count: 1 + path: src/Utils/Table.php + + - + message: "#^Cannot access property \\$table on PhpMyAdmin\\\\SqlParser\\\\Components\\\\Expression\\|null\\.$#" + count: 1 + path: src/Utils/Table.php + - message: "#^Cannot call method has\\(\\) on PhpMyAdmin\\\\SqlParser\\\\Components\\\\OptionsArray\\|null\\.$#" - count: 2 + count: 4 + path: src/Utils/Table.php + + - + message: "#^Method PhpMyAdmin\\\\SqlParser\\\\Utils\\\\Table\\:\\:getFields\\(\\) should return array\\ but returns array\\\\.$#" + count: 1 path: src/Utils/Table.php - diff --git a/psalm-baseline.xml b/psalm-baseline.xml index c8b0657c..c770ec69 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,9 +1,9 @@ - - $options - + + has + @@ -21,10 +21,13 @@ - + + name]]> + + $name - $options - + options]]> + @@ -38,9 +41,6 @@ - - $expr - $type @@ -81,10 +81,10 @@ - - $table - $type - + + table]]> + type]]> + @@ -108,44 +108,49 @@ - - $expr - + + expr]]> + - - $inOut - $name - $type - + + name]]> + + + type]]> + + + inOut)]]> + - - $expr - $isSubpartition - $name - $options - $subpartitions - $type - + + expr]]> + name]]> + name]]> + options]]> + options]]> + $partitionOptions - - options)]]> - + + subpartitions)]]> + type)]]> + type)]]> + - - $options - $table - + + options]]> + table]]> + - - $new - $old - + + new]]> + old]]> + @@ -418,6 +423,10 @@ + + has + isEmpty + $state === 1 + + name)]]> + @@ -535,6 +547,7 @@ expr]]> + value]]> value]]> value]]> value]]> @@ -544,6 +557,7 @@ alias)]]> alias)]]> database)]]> + function)]]> subquery)]]> @@ -561,15 +575,6 @@ $state === 1 - - - Expressions::parse($parser, $list) - - - expr)]]> - expr)]]> - - type]]> @@ -619,11 +624,6 @@ value]]> - - - 'table'])]]> - - options[$lastOptionId]['name']]]> @@ -697,39 +697,13 @@ empty($lastOption[2]) - - - Expressions::parse($parser, $list) - - - expr)]]> - expr)]]> - - - - DataTypes::parse($parser, $list) - value]]> - - name)]]> - - - true, - 'breakOnAlias' => true, - ], - )]]> - - value]]> value]]> values]]> - - 'table', - 'breakOnAlias' => true, - ], - )]]> - - - - - true, - 'parseField' => 'table', - ], - )]]> - true, - 'parseField' => 'table', - ], - )]]> - - - old)]]> - @@ -1359,6 +1300,24 @@ + + name, + implode(',', $type->parameters), + implode(' ', $options), + ]]]> + inOut) ? '' : $param->inOut, + $param->name, + $param->type->name, + implode(',', $param->type->parameters), + implode(' ', $options), + ]]]> + + + string[] + string[] + $options $options @@ -1377,11 +1336,35 @@ $options[] + + type->parameters]]> + type->parameters]]> + + + type->options->options]]> + type->options->options]]> + options->options]]> + + + type->name]]> + type->name]]> + type->options]]> + type->options]]> + type->options->options]]> + type->options->options]]> + type->parameters]]> + type->parameters]]> + options->options]]> + + inOut)]]> parameters)]]> + + $ret + $opt $opt @@ -1395,6 +1378,16 @@ name]['default_value']]]> name]['expr']]]> + + ]]> + $ret $ret @@ -1403,9 +1396,14 @@ $ret $ret + + references->table->database]]> + references->table->table]]> + has has + has fields)]]> diff --git a/src/Components/AlterOperation.php b/src/Components/AlterOperation.php index fb163ba4..2d61777b 100644 --- a/src/Components/AlterOperation.php +++ b/src/Components/AlterOperation.php @@ -18,27 +18,23 @@ final class AlterOperation implements Component { /** * Options of this operation. - * - * @var OptionsArray */ - public $options; + public OptionsArray|null $options = null; /** * The altered field. - * - * @var Expression|string|null */ - public $field; + public Expression|string|null $field = null; /** * The partitions. * * @var PartitionDefinition[]|null */ - public $partitions; + public array|null $partitions = null; /** - * @param OptionsArray $options options of alter operation + * @param OptionsArray|null $options options of alter operation * @param Expression|string|null $field altered field * @param PartitionDefinition[]|null $partitions partitions definition found in the operation * @param Token[] $unknown unparsed tokens found at the end of operation diff --git a/src/Components/CaseExpression.php b/src/Components/CaseExpression.php index 50ee2aa3..97336c67 100644 --- a/src/Components/CaseExpression.php +++ b/src/Components/CaseExpression.php @@ -17,52 +17,44 @@ final class CaseExpression implements Component { /** * The value to be compared. - * - * @var Expression|null */ - public $value; + public Expression|null $value = null; /** * The conditions in WHEN clauses. * * @var Condition[][] */ - public $conditions = []; + public array $conditions = []; /** * The results matching with the WHEN clauses. * * @var Expression[] */ - public $results = []; + public array $results = []; /** * The values to be compared against. * * @var Expression[] */ - public $compareValues = []; + public array $compareValues = []; /** * The result in ELSE section of expr. - * - * @var Expression|null */ - public $elseResult; + public Expression|null $elseResult = null; /** * The alias of this CASE statement. - * - * @var string|null */ - public $alias; + public string|null $alias = null; /** * The sub-expression. - * - * @var string */ - public $expr = ''; + public string $expr = ''; public function build(): string { diff --git a/src/Components/Condition.php b/src/Components/Condition.php index d24a58a8..6b08b796 100644 --- a/src/Components/Condition.php +++ b/src/Components/Condition.php @@ -15,21 +15,17 @@ final class Condition implements Component * * @var array */ - public $identifiers = []; + public array $identifiers = []; /** * Whether this component is an operator. - * - * @var bool */ - public $isOperator = false; + public bool $isOperator = false; /** * The condition. - * - * @var string */ - public $expr; + public string $expr; /** @param string $expr the condition or the operator */ public function __construct(string|null $expr = null) diff --git a/src/Components/CreateDefinition.php b/src/Components/CreateDefinition.php index e07c1003..491c7bf9 100644 --- a/src/Components/CreateDefinition.php +++ b/src/Components/CreateDefinition.php @@ -18,45 +18,33 @@ final class CreateDefinition implements Component { /** * The name of the new column. - * - * @var string|null */ - public $name; + public string|null $name = null; /** * Whether this field is a constraint or not. - * - * @var bool|null */ - public $isConstraint; + public bool|null $isConstraint = null; /** * The data type of thew new column. - * - * @var DataType|null */ - public $type; + public DataType|null $type = null; /** * The key. - * - * @var Key|null */ - public $key; + public Key|null $key = null; /** * The table that is referenced. - * - * @var Reference|null */ - public $references; + public Reference|null $references = null; /** * The options of this field. - * - * @var OptionsArray|null */ - public $options; + public OptionsArray|null $options = null; /** * @param string|null $name the name of the field diff --git a/src/Components/DataType.php b/src/Components/DataType.php index 4dbf3183..d6661746 100644 --- a/src/Components/DataType.php +++ b/src/Components/DataType.php @@ -17,10 +17,8 @@ final class DataType implements Component { /** * The name of the data type. - * - * @var string */ - public $name; + public string|null $name = null; /** * The parameters of this data type. @@ -39,17 +37,15 @@ final class DataType implements Component /** * The options of this data type. - * - * @var OptionsArray */ - public $options; + public OptionsArray|null $options = null; public bool $lowercase = false; /** - * @param string $name the name of this data type - * @param int[]|string[] $parameters the parameters (size or possible values) - * @param OptionsArray $options the options of this data type + * @param string|null $name the name of this data type + * @param int[]|string[] $parameters the parameters (size or possible values) + * @param OptionsArray|null $options the options of this data type */ public function __construct( string|null $name = null, diff --git a/src/Components/Expression.php b/src/Components/Expression.php index e7a0a3e2..9d329092 100644 --- a/src/Components/Expression.php +++ b/src/Components/Expression.php @@ -19,52 +19,38 @@ final class Expression implements Component { /** * The name of this database. - * - * @var string|null */ - public $database; + public string|null $database = null; /** * The name of this table. - * - * @var string|null */ - public $table; + public string|null $table = null; /** * The name of the column. - * - * @var string|null */ - public $column; + public string|null $column = null; /** * The sub-expression. - * - * @var string|null */ - public $expr = ''; + public string|null $expr = ''; /** * The alias of this expression. - * - * @var string|null */ - public $alias; + public string|null $alias = null; /** * The name of the function. - * - * @var mixed */ - public $function; + public string|null $function = null; /** * The type of subquery. - * - * @var string|null */ - public $subquery; + public string|null $subquery = null; /** * Syntax: diff --git a/src/Components/FunctionCall.php b/src/Components/FunctionCall.php index 61903517..5c7c2d8d 100644 --- a/src/Components/FunctionCall.php +++ b/src/Components/FunctionCall.php @@ -15,17 +15,13 @@ final class FunctionCall implements Component { /** * The name of this function. - * - * @var string|null */ - public $name; + public string|null $name = null; /** * The list of parameters. - * - * @var ArrayObj|null */ - public $parameters; + public ArrayObj|null $parameters = null; /** * @param string|null $name the name of the function to be called diff --git a/src/Components/GroupKeyword.php b/src/Components/GroupKeyword.php index cfec7c09..94059e4a 100644 --- a/src/Components/GroupKeyword.php +++ b/src/Components/GroupKeyword.php @@ -18,12 +18,10 @@ final class GroupKeyword implements Component /** * The expression that is used for grouping. - * - * @var Expression */ - public $expr; + public Expression|null $expr = null; - /** @param Expression $expr the expression that we are sorting by */ + /** @param Expression|null $expr the expression that we are sorting by */ public function __construct(Expression|null $expr = null) { $this->expr = $expr; diff --git a/src/Components/IntoKeyword.php b/src/Components/IntoKeyword.php index 4f52322c..f7caf3ee 100644 --- a/src/Components/IntoKeyword.php +++ b/src/Components/IntoKeyword.php @@ -53,56 +53,46 @@ final class IntoKeyword implements Component /** * Type of target (OUTFILE or SYMBOL). - * - * @var string|null */ - public $type; + public string|null $type = null; /** * The destination, which can be a table or a file. - * - * @var string|Expression|null */ - public $dest; + public string|Expression|null $dest = null; /** * The name of the columns. * * @var string[]|null */ - public $columns; + public array|null $columns = null; /** * The values to be selected into (SELECT .. INTO @var1). * * @var Expression[]|null */ - public $values; + public array|null $values = null; /** * Options for FIELDS/COLUMNS keyword. * * @see IntoKeyword::STATEMENT_FIELDS_OPTIONS - * - * @var OptionsArray|null */ - public $fieldsOptions; + public OptionsArray|null $fieldsOptions = null; /** * Whether to use `FIELDS` or `COLUMNS` while building. - * - * @var bool|null */ - public $fieldsKeyword; + public bool|null $fieldsKeyword = null; /** * Options for OPTIONS keyword. * * @see IntoKeyword::STATEMENT_LINES_OPTIONS - * - * @var OptionsArray|null */ - public $linesOptions; + public OptionsArray|null $linesOptions = null; /** * @param string|null $type type of destination (may be OUTFILE) diff --git a/src/Components/JoinKeyword.php b/src/Components/JoinKeyword.php index 094c0cfb..ea7b882e 100644 --- a/src/Components/JoinKeyword.php +++ b/src/Components/JoinKeyword.php @@ -39,31 +39,25 @@ final class JoinKeyword implements Component * Type of this join. * * @see JoinKeyword::JOINS - * - * @var string|null */ - public $type; + public string|null $type = null; /** * Join expression. - * - * @var Expression|null */ - public $expr; + public Expression|null $expr = null; /** * Join conditions. * * @var Condition[]|null */ - public $on; + public array|null $on = null; /** * Columns in Using clause. - * - * @var ArrayObj|null */ - public $using; + public ArrayObj|null $using = null; /** * @see JoinKeyword::JOINS diff --git a/src/Components/Key.php b/src/Components/Key.php index 576b301b..99991930 100644 --- a/src/Components/Key.php +++ b/src/Components/Key.php @@ -19,10 +19,8 @@ final class Key implements Component { /** * The name of this key. - * - * @var string|null */ - public $name; + public string|null $name = null; /** * The key columns @@ -30,28 +28,22 @@ final class Key implements Component * @var array> * @phpstan-var array{name?: string, length?: int, order?: string}[] */ - public $columns; + public array $columns; /** * The type of this key. - * - * @var string|null */ - public $type; + public string|null $type = null; /** * The expression if the Key is not using column names - * - * @var string|null */ - public $expr = null; + public string|null $expr = null; /** * The options of this key or null if none where found. - * - * @var OptionsArray|null */ - public $options; + public OptionsArray|null $options = null; /** * @param string|null $name the name of the key diff --git a/src/Components/Limit.php b/src/Components/Limit.php index 89085a1f..32deb2c8 100644 --- a/src/Components/Limit.php +++ b/src/Components/Limit.php @@ -13,17 +13,13 @@ final class Limit implements Component { /** * The number of rows skipped. - * - * @var int|string */ - public $offset; + public int|string $offset; /** * The number of rows to be returned. - * - * @var int|string */ - public $rowCount; + public int|string $rowCount; /** * @param int|string $rowCount the row count diff --git a/src/Components/LockExpression.php b/src/Components/LockExpression.php index 042b9243..adbc00d5 100644 --- a/src/Components/LockExpression.php +++ b/src/Components/LockExpression.php @@ -15,17 +15,13 @@ final class LockExpression implements Component { /** * The table to be locked. - * - * @var Expression */ - public $table; + public Expression|null $table = null; /** * The type of lock to be applied. - * - * @var string */ - public $type; + public string|null $type = null; public function build(): string { diff --git a/src/Components/OrderKeyword.php b/src/Components/OrderKeyword.php index caee43ac..9b4a013e 100644 --- a/src/Components/OrderKeyword.php +++ b/src/Components/OrderKeyword.php @@ -13,21 +13,17 @@ final class OrderKeyword implements Component { /** * The expression that is used for ordering. - * - * @var Expression */ - public $expr; + public Expression|null $expr = null; /** * The order type. - * - * @var string */ - public $type; + public string $type; /** - * @param Expression $expr the expression that we are sorting by - * @param string $type the sorting type + * @param Expression|null $expr the expression that we are sorting by + * @param string $type the sorting type */ public function __construct(Expression|null $expr = null, string $type = 'ASC') { diff --git a/src/Components/ParameterDefinition.php b/src/Components/ParameterDefinition.php index cbe30bb7..c7c168d1 100644 --- a/src/Components/ParameterDefinition.php +++ b/src/Components/ParameterDefinition.php @@ -16,29 +16,23 @@ final class ParameterDefinition implements Component { /** * The name of the new column. - * - * @var string */ - public $name; + public string|null $name = null; /** * Parameter's direction (IN, OUT or INOUT). - * - * @var string */ - public $inOut; + public string|null $inOut = null; /** * The data type of thew new column. - * - * @var DataType */ - public $type; + public DataType|null $type = null; /** - * @param string $name parameter's name - * @param string $inOut parameter's directional type (IN / OUT or None) - * @param DataType $type parameter's type + * @param string|null $name parameter's name + * @param string|null $inOut parameter's directional type (IN / OUT or None) + * @param DataType|null $type parameter's type */ public function __construct(string|null $name = null, string|null $inOut = null, DataType|null $type = null) { diff --git a/src/Components/PartitionDefinition.php b/src/Components/PartitionDefinition.php index f2544c23..ce387485 100644 --- a/src/Components/PartitionDefinition.php +++ b/src/Components/PartitionDefinition.php @@ -22,7 +22,7 @@ final class PartitionDefinition implements Component * @var array> * @psalm-var array [ 1, 'var', @@ -63,45 +63,35 @@ final class PartitionDefinition implements Component /** * Whether this entry is a subpartition or a partition. - * - * @var bool */ - public $isSubpartition; + public bool|null $isSubpartition = null; /** * The name of this partition. - * - * @var string */ - public $name; + public string|null $name = null; /** * The type of this partition (what follows the `VALUES` keyword). - * - * @var string */ - public $type; + public string|null $type = null; /** * The expression used to defined this partition. - * - * @var Expression|string */ - public $expr; + public Expression|string|null $expr = null; /** * The subpartitions of this partition. * - * @var PartitionDefinition[] + * @var PartitionDefinition[]|null */ - public $subpartitions; + public array|null $subpartitions = null; /** * The options of this field. - * - * @var OptionsArray */ - public $options; + public OptionsArray|null $options = null; public function build(): string { diff --git a/src/Components/Reference.php b/src/Components/Reference.php index 45fbbc82..8f9e9040 100644 --- a/src/Components/Reference.php +++ b/src/Components/Reference.php @@ -17,29 +17,25 @@ final class Reference implements Component { /** * The referenced table. - * - * @var Expression */ - public $table; + public Expression|null $table = null; /** * The referenced columns. * * @var string[] */ - public $columns; + public array $columns; /** * The options of the referencing. - * - * @var OptionsArray */ - public $options; + public OptionsArray|null $options = null; /** - * @param Expression $table the name of the table referenced - * @param string[] $columns the columns referenced - * @param OptionsArray $options the options + * @param Expression|null $table the name of the table referenced + * @param string[] $columns the columns referenced + * @param OptionsArray|null $options the options */ public function __construct(Expression|null $table = null, array $columns = [], OptionsArray|null $options = null) { diff --git a/src/Components/RenameOperation.php b/src/Components/RenameOperation.php index ef111383..43e20720 100644 --- a/src/Components/RenameOperation.php +++ b/src/Components/RenameOperation.php @@ -13,21 +13,17 @@ final class RenameOperation implements Component { /** * The old table name. - * - * @var Expression */ - public $old; + public Expression|null $old = null; /** * The new table name. - * - * @var Expression */ - public $new; + public Expression|null $new = null; /** - * @param Expression $old old expression - * @param Expression $new new expression containing new name + * @param Expression|null $old old expression + * @param Expression|null $new new expression containing new name */ public function __construct(Expression|null $old = null, Expression|null $new = null) { diff --git a/src/Components/SetOperation.php b/src/Components/SetOperation.php index 58386aeb..af2dd4c3 100644 --- a/src/Components/SetOperation.php +++ b/src/Components/SetOperation.php @@ -10,17 +10,13 @@ final class SetOperation implements Component { /** * The name of the column that is being updated. - * - * @var string */ - public $column; + public string $column; /** * The new value. - * - * @var string */ - public $value; + public string $value; /** * @param string $column Field's name.. diff --git a/src/Components/WithKeyword.php b/src/Components/WithKeyword.php index e3eb96cc..af860021 100644 --- a/src/Components/WithKeyword.php +++ b/src/Components/WithKeyword.php @@ -14,18 +14,13 @@ */ final class WithKeyword implements Component { - /** @var string */ - public $name; - /** @var ArrayObj[] */ - public $columns = []; + public array $columns = []; - /** @var Parser|null */ - public $statement; + public Parser|null $statement = null; - public function __construct(string $name) + public function __construct(public string $name) { - $this->name = $name; } public function build(): string diff --git a/src/Parsers/PartitionDefinitions.php b/src/Parsers/PartitionDefinitions.php index adf5035c..cca15f3c 100644 --- a/src/Parsers/PartitionDefinitions.php +++ b/src/Parsers/PartitionDefinitions.php @@ -25,7 +25,7 @@ final class PartitionDefinitions implements Parseable * @var array> * @psalm-var array [ 1, 'var', @@ -115,7 +115,7 @@ public static function parse(Parser $parser, TokensList $list, array $options = $ret->isSubpartition = ($token->type === TokenType::Keyword) && ($token->keyword === 'SUBPARTITION'); $state = 1; } elseif ($state === 1) { - $ret->name = $token->value; + $ret->name = (string) $token->value; // Looking ahead for a 'VALUES' keyword. // Loop until the end of the partition name (delimited by a whitespace) diff --git a/tests/Components/LockExpressionTest.php b/tests/Components/LockExpressionTest.php index 3b0a4837..1b96ce1d 100644 --- a/tests/Components/LockExpressionTest.php +++ b/tests/Components/LockExpressionTest.php @@ -15,6 +15,7 @@ class LockExpressionTest extends TestCase public function testParse(): void { $component = LockExpressions::parse(new Parser(), $this->getTokensList('table1 AS t1 READ LOCAL')); + $this->assertNotNull($component->table); $this->assertEquals('table1', $component->table->table); $this->assertEquals('t1', $component->table->alias); $this->assertEquals('READ LOCAL', $component->type); @@ -23,6 +24,7 @@ public function testParse(): void public function testParse2(): void { $component = LockExpressions::parse(new Parser(), $this->getTokensList('table1 LOW_PRIORITY WRITE')); + $this->assertNotNull($component->table); $this->assertEquals('table1', $component->table->table); $this->assertEquals('LOW_PRIORITY WRITE', $component->type); } diff --git a/tests/Components/ReferenceTest.php b/tests/Components/ReferenceTest.php index 068cddd1..6ccda5ca 100644 --- a/tests/Components/ReferenceTest.php +++ b/tests/Components/ReferenceTest.php @@ -15,6 +15,7 @@ class ReferenceTest extends TestCase public function testParse(): void { $component = References::parse(new Parser(), $this->getTokensList('tbl (id)')); + $this->assertNotNull($component->table); $this->assertEquals('tbl', $component->table->table); $this->assertEquals(['id'], $component->columns); } diff --git a/tests/Utils/CLITest.php b/tests/Utils/CLITest.php index e4b754fa..89e1a300 100644 --- a/tests/Utils/CLITest.php +++ b/tests/Utils/CLITest.php @@ -16,7 +16,7 @@ class CLITest extends TestCase { /** @param array|false $getopt */ - private function getCLI($getopt): CLI + private function getCLI(array|false $getopt): CLI { $cli = $this->createPartialMock(CLI::class, ['getopt']); $cli->method('getopt')->willReturn($getopt); @@ -25,7 +25,7 @@ private function getCLI($getopt): CLI } /** @param array|false $getopt */ - private function getCLIStdIn(string $input, $getopt): CLI + private function getCLIStdIn(string $input, array|false $getopt): CLI { $cli = $this->createPartialMock(CLI::class, ['getopt', 'readStdin']); $cli->method('getopt')->willReturn($getopt); diff --git a/tests/data/bugs/fuzz3.out b/tests/data/bugs/fuzz3.out index 2bbc85e6..882e7a46 100644 --- a/tests/data/bugs/fuzz3.out +++ b/tests/data/bugs/fuzz3.out @@ -95,9 +95,9 @@ "withers": { "A": { "@type": "PhpMyAdmin\\SqlParser\\Components\\WithKeyword", - "name": "A", "columns": [], - "statement": null + "statement": null, + "name": "A" } }, "cteStatementParser": null, diff --git a/tests/data/parser/parseCreateViewAsWithAs.out b/tests/data/parser/parseCreateViewAsWithAs.out index 5f6d0320..3fff4406 100644 --- a/tests/data/parser/parseCreateViewAsWithAs.out +++ b/tests/data/parser/parseCreateViewAsWithAs.out @@ -1706,7 +1706,6 @@ "withers": { "cte": { "@type": "PhpMyAdmin\\SqlParser\\Components\\WithKeyword", - "name": "cte", "columns": [], "statement": { "@type": "PhpMyAdmin\\SqlParser\\Parser", @@ -1838,7 +1837,8 @@ } ], "brackets": 0 - } + }, + "name": "cte" } }, "cteStatementParser": { @@ -2268,7 +2268,6 @@ "withers": { "cte": { "@type": "PhpMyAdmin\\SqlParser\\Components\\WithKeyword", - "name": "cte", "columns": [], "statement": { "@type": "PhpMyAdmin\\SqlParser\\Parser", @@ -2400,11 +2399,11 @@ } ], "brackets": 0 - } + }, + "name": "cte" }, "cte2": { "@type": "PhpMyAdmin\\SqlParser\\Components\\WithKeyword", - "name": "cte2", "columns": [], "statement": { "@type": "PhpMyAdmin\\SqlParser\\Parser", @@ -2560,7 +2559,8 @@ } ], "brackets": 0 - } + }, + "name": "cte2" } }, "cteStatementParser": { diff --git a/tests/data/parser/parseWithStatement.out b/tests/data/parser/parseWithStatement.out index 26bb6bfc..e577c672 100644 --- a/tests/data/parser/parseWithStatement.out +++ b/tests/data/parser/parseWithStatement.out @@ -484,7 +484,6 @@ "withers": { "cte": { "@type": "PhpMyAdmin\\SqlParser\\Components\\WithKeyword", - "name": "cte", "columns": [ { "@type": "PhpMyAdmin\\SqlParser\\Components\\ArrayObj", @@ -617,7 +616,8 @@ } ], "brackets": 0 - } + }, + "name": "cte" } }, "cteStatementParser": { diff --git a/tests/data/parser/parseWithStatement1.out b/tests/data/parser/parseWithStatement1.out index 2e8bc479..22760aa0 100644 --- a/tests/data/parser/parseWithStatement1.out +++ b/tests/data/parser/parseWithStatement1.out @@ -474,7 +474,6 @@ "withers": { "cte": { "@type": "PhpMyAdmin\\SqlParser\\Components\\WithKeyword", - "name": "cte", "columns": [ { "@type": "PhpMyAdmin\\SqlParser\\Components\\ArrayObj", @@ -607,7 +606,8 @@ } ], "brackets": 0 - } + }, + "name": "cte" } }, "cteStatementParser": { diff --git a/tests/data/parser/parseWithStatement2.out b/tests/data/parser/parseWithStatement2.out index 1a0b1c33..9007b0a7 100644 --- a/tests/data/parser/parseWithStatement2.out +++ b/tests/data/parser/parseWithStatement2.out @@ -572,7 +572,6 @@ "withers": { "cte": { "@type": "PhpMyAdmin\\SqlParser\\Components\\WithKeyword", - "name": "cte", "columns": [ { "@type": "PhpMyAdmin\\SqlParser\\Components\\ArrayObj", @@ -648,7 +647,8 @@ } ], "brackets": 0 - } + }, + "name": "cte" } }, "cteStatementParser": { diff --git a/tests/data/parser/parseWithStatement3.out b/tests/data/parser/parseWithStatement3.out index 46380d8f..f766c0f5 100644 --- a/tests/data/parser/parseWithStatement3.out +++ b/tests/data/parser/parseWithStatement3.out @@ -1307,7 +1307,6 @@ "withers": { "categories": { "@type": "PhpMyAdmin\\SqlParser\\Components\\WithKeyword", - "name": "categories", "columns": [ { "@type": "PhpMyAdmin\\SqlParser\\Components\\ArrayObj", @@ -1722,11 +1721,11 @@ } ], "brackets": 0 - } + }, + "name": "categories" }, "foo": { "@type": "PhpMyAdmin\\SqlParser\\Components\\WithKeyword", - "name": "foo", "columns": [], "statement": { "@type": "PhpMyAdmin\\SqlParser\\Parser", @@ -1815,7 +1814,8 @@ } ], "brackets": 0 - } + }, + "name": "foo" } }, "cteStatementParser": { diff --git a/tests/data/parser/parseWithStatement4.out b/tests/data/parser/parseWithStatement4.out index 8d34e4e1..37fb4f5c 100644 --- a/tests/data/parser/parseWithStatement4.out +++ b/tests/data/parser/parseWithStatement4.out @@ -430,7 +430,6 @@ "withers": { "cte": { "@type": "PhpMyAdmin\\SqlParser\\Components\\WithKeyword", - "name": "cte", "columns": [ { "@type": "PhpMyAdmin\\SqlParser\\Components\\ArrayObj", @@ -563,7 +562,8 @@ } ], "brackets": 0 - } + }, + "name": "cte" } }, "cteStatementParser": null, diff --git a/tests/data/parser/parseWithStatement5.out b/tests/data/parser/parseWithStatement5.out index b34fc0a2..f084a4e5 100644 --- a/tests/data/parser/parseWithStatement5.out +++ b/tests/data/parser/parseWithStatement5.out @@ -485,7 +485,6 @@ "withers": { "aa": { "@type": "PhpMyAdmin\\SqlParser\\Components\\WithKeyword", - "name": "aa", "columns": [ { "@type": "PhpMyAdmin\\SqlParser\\Components\\ArrayObj", @@ -618,7 +617,8 @@ } ], "brackets": 0 - } + }, + "name": "aa" } }, "cteStatementParser": { diff --git a/tests/data/parser/parseWithStatement7.out b/tests/data/parser/parseWithStatement7.out index cd189d49..5ecf7327 100644 --- a/tests/data/parser/parseWithStatement7.out +++ b/tests/data/parser/parseWithStatement7.out @@ -559,7 +559,6 @@ "withers": { "cte": { "@type": "PhpMyAdmin\\SqlParser\\Components\\WithKeyword", - "name": "cte", "columns": [ { "@type": "PhpMyAdmin\\SqlParser\\Components\\ArrayObj", @@ -692,7 +691,8 @@ } ], "brackets": 0 - } + }, + "name": "cte" } }, "cteStatementParser": { diff --git a/tests/data/parser/parseWithStatementErr.out b/tests/data/parser/parseWithStatementErr.out index f227b582..56a3fa29 100644 --- a/tests/data/parser/parseWithStatementErr.out +++ b/tests/data/parser/parseWithStatementErr.out @@ -473,9 +473,9 @@ "withers": { "cte": { "@type": "PhpMyAdmin\\SqlParser\\Components\\WithKeyword", - "name": "cte", "columns": [], - "statement": null + "statement": null, + "name": "cte" } }, "cteStatementParser": null, diff --git a/tests/data/parser/parseWithStatementErr1.out b/tests/data/parser/parseWithStatementErr1.out index b0983912..bdad09ff 100644 --- a/tests/data/parser/parseWithStatementErr1.out +++ b/tests/data/parser/parseWithStatementErr1.out @@ -452,7 +452,6 @@ "withers": { "cte": { "@type": "PhpMyAdmin\\SqlParser\\Components\\WithKeyword", - "name": "cte", "columns": [ { "@type": "PhpMyAdmin\\SqlParser\\Components\\ArrayObj", @@ -464,7 +463,8 @@ ] } ], - "statement": null + "statement": null, + "name": "cte" } }, "cteStatementParser": null, diff --git a/tests/data/parser/parseWithStatementErr2.out b/tests/data/parser/parseWithStatementErr2.out index 7b690d3e..cb16b2d0 100644 --- a/tests/data/parser/parseWithStatementErr2.out +++ b/tests/data/parser/parseWithStatementErr2.out @@ -306,7 +306,6 @@ "withers": { "cte": { "@type": "PhpMyAdmin\\SqlParser\\Components\\WithKeyword", - "name": "cte", "columns": [ { "@type": "PhpMyAdmin\\SqlParser\\Components\\ArrayObj", @@ -439,7 +438,8 @@ } ], "brackets": 0 - } + }, + "name": "cte" } }, "cteStatementParser": null, diff --git a/tests/data/parser/parseWithStatementErr3.out b/tests/data/parser/parseWithStatementErr3.out index a1153a9f..b7437a35 100644 --- a/tests/data/parser/parseWithStatementErr3.out +++ b/tests/data/parser/parseWithStatementErr3.out @@ -397,7 +397,6 @@ "withers": { "cte": { "@type": "PhpMyAdmin\\SqlParser\\Components\\WithKeyword", - "name": "cte", "columns": [ { "@type": "PhpMyAdmin\\SqlParser\\Components\\ArrayObj", @@ -530,7 +529,8 @@ } ], "brackets": 0 - } + }, + "name": "cte" } }, "cteStatementParser": null, diff --git a/tests/data/parser/parseWithStatementErr4.out b/tests/data/parser/parseWithStatementErr4.out index 31298919..8da216c6 100644 --- a/tests/data/parser/parseWithStatementErr4.out +++ b/tests/data/parser/parseWithStatementErr4.out @@ -408,7 +408,6 @@ "withers": { "cte": { "@type": "PhpMyAdmin\\SqlParser\\Components\\WithKeyword", - "name": "cte", "columns": [ { "@type": "PhpMyAdmin\\SqlParser\\Components\\ArrayObj", @@ -541,7 +540,8 @@ } ], "brackets": 0 - } + }, + "name": "cte" } }, "cteStatementParser": null, diff --git a/tests/data/parser/parseWithStatementErr6.out b/tests/data/parser/parseWithStatementErr6.out index f938e812..fdcea525 100644 --- a/tests/data/parser/parseWithStatementErr6.out +++ b/tests/data/parser/parseWithStatementErr6.out @@ -836,7 +836,6 @@ "withers": { "cte": { "@type": "PhpMyAdmin\\SqlParser\\Components\\WithKeyword", - "name": "cte", "columns": [ { "@type": "PhpMyAdmin\\SqlParser\\Components\\ArrayObj", @@ -848,7 +847,8 @@ ] } ], - "statement": null + "statement": null, + "name": "cte" } }, "cteStatementParser": null, diff --git a/tests/data/parser/parseWithStatementErr7.out b/tests/data/parser/parseWithStatementErr7.out index 35c615d9..bb5acb97 100644 --- a/tests/data/parser/parseWithStatementErr7.out +++ b/tests/data/parser/parseWithStatementErr7.out @@ -416,7 +416,6 @@ "withers": { "cte": { "@type": "PhpMyAdmin\\SqlParser\\Components\\WithKeyword", - "name": "cte", "columns": [ { "@type": "PhpMyAdmin\\SqlParser\\Components\\ArrayObj", @@ -428,7 +427,8 @@ ] } ], - "statement": null + "statement": null, + "name": "cte" } }, "cteStatementParser": null, diff --git a/tests/data/parser/parseWithStatementErr8.out b/tests/data/parser/parseWithStatementErr8.out index fd5fdd0f..147b07e3 100644 --- a/tests/data/parser/parseWithStatementErr8.out +++ b/tests/data/parser/parseWithStatementErr8.out @@ -394,7 +394,6 @@ "withers": { "cte": { "@type": "PhpMyAdmin\\SqlParser\\Components\\WithKeyword", - "name": "cte", "columns": [ { "@type": "PhpMyAdmin\\SqlParser\\Components\\ArrayObj", @@ -527,7 +526,8 @@ } ], "brackets": 0 - } + }, + "name": "cte" } }, "cteStatementParser": null,