diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 644c40f9..f1d7c7e4 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -541,12 +541,12 @@ parameters: path: src/Statements/ExplainStatement.php - - message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Statements\\\\ExplainStatement\\:\\:\\$connectionId \\(int\\|null\\) does not accept mixed\\.$#" + message: "#^Cannot cast mixed to string\\.$#" count: 1 path: src/Statements/ExplainStatement.php - - message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Statements\\\\ExplainStatement\\:\\:\\$explainedColumn \\(string\\|null\\) does not accept mixed\\.$#" + message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Statements\\\\ExplainStatement\\:\\:\\$connectionId \\(int\\|null\\) does not accept mixed\\.$#" count: 1 path: src/Statements/ExplainStatement.php @@ -590,11 +590,6 @@ parameters: count: 1 path: src/Statements/MaintenanceStatement.php - - - message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Statements\\\\PurgeStatement\\:\\:\\$endExpr \\(string\\|null\\) does not accept PhpMyAdmin\\\\SqlParser\\\\Components\\\\Expression\\|null\\.$#" - count: 1 - path: src/Statements/PurgeStatement.php - - message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Statements\\\\PurgeStatement\\:\\:\\$endOption \\(string\\|null\\) does not accept mixed\\.$#" count: 1 diff --git a/psalm-baseline.xml b/psalm-baseline.xml index fc6167c3..e8b7f399 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -770,9 +770,6 @@ )]]> ArrayObj::parse($parser, $list) - - fields instanceof ArrayObj]]> - @@ -811,7 +808,6 @@ connectionId]]> - explainedColumn]]> explainedDatabase]]> explainedTable]]> @@ -866,9 +862,6 @@ - - Expression::parse($parser, $list, []) - endOption]]> logType]]> diff --git a/src/Statement.php b/src/Statement.php index 77a906b0..7b95130d 100644 --- a/src/Statement.php +++ b/src/Statement.php @@ -45,7 +45,7 @@ abstract class Statement implements Stringable * @var array> * @psalm-var array 1, 'OFFLINE' => 1, 'IGNORE' => 2, diff --git a/src/Statements/AnalyzeStatement.php b/src/Statements/AnalyzeStatement.php index 5f54adf8..b32fdde5 100644 --- a/src/Statements/AnalyzeStatement.php +++ b/src/Statements/AnalyzeStatement.php @@ -21,7 +21,7 @@ class AnalyzeStatement extends Statement * @var array> * @psalm-var array 1, 'NO_WRITE_TO_BINLOG' => 2, @@ -33,5 +33,5 @@ class AnalyzeStatement extends Statement * * @var Expression[]|null */ - public $tables; + public array|null $tables = null; } diff --git a/src/Statements/BackupStatement.php b/src/Statements/BackupStatement.php index 771e4305..f0e1fb43 100644 --- a/src/Statements/BackupStatement.php +++ b/src/Statements/BackupStatement.php @@ -17,7 +17,7 @@ class BackupStatement extends MaintenanceStatement * @var array> * @psalm-var array 1, 'NO_WRITE_TO_BINLOG' => 2, diff --git a/src/Statements/CallStatement.php b/src/Statements/CallStatement.php index d212b56c..f39c52cb 100644 --- a/src/Statements/CallStatement.php +++ b/src/Statements/CallStatement.php @@ -22,10 +22,8 @@ class CallStatement extends Statement { /** * The name of the function and its parameters. - * - * @var FunctionCall|null */ - public $call; + public FunctionCall|null $call = null; /** * Build statement for CALL. diff --git a/src/Statements/CheckStatement.php b/src/Statements/CheckStatement.php index 6021a67f..47a805c5 100644 --- a/src/Statements/CheckStatement.php +++ b/src/Statements/CheckStatement.php @@ -17,7 +17,7 @@ class CheckStatement extends MaintenanceStatement * @var array> * @psalm-var array 1, 'FOR UPGRADE' => 2, diff --git a/src/Statements/ChecksumStatement.php b/src/Statements/ChecksumStatement.php index 2ceee361..4b662e1a 100644 --- a/src/Statements/ChecksumStatement.php +++ b/src/Statements/ChecksumStatement.php @@ -17,7 +17,7 @@ class ChecksumStatement extends MaintenanceStatement * @var array> * @psalm-var array 1, 'QUICK' => 2, diff --git a/src/Statements/CreateStatement.php b/src/Statements/CreateStatement.php index ff40e15f..33662bb3 100644 --- a/src/Statements/CreateStatement.php +++ b/src/Statements/CreateStatement.php @@ -31,7 +31,7 @@ class CreateStatement extends Statement * @var array> * @psalm-var array 1, @@ -279,10 +279,8 @@ class CreateStatement extends Statement * @see CreateStatement::TABLE_OPTIONS * @see CreateStatement::FUNCTION_OPTIONS * @see CreateStatement::TRIGGER_OPTIONS - * - * @var OptionsArray|null */ - public $entityOptions; + public OptionsArray|null $entityOptions = null; /** * If `CREATE TABLE`, a list of columns and keys. @@ -292,7 +290,7 @@ class CreateStatement extends Statement * * @var CreateDefinition[]|ArrayObj|null */ - public $fields; + public array|ArrayObj|null $fields = null; /** * If `CREATE TABLE WITH`. @@ -300,82 +298,64 @@ class CreateStatement extends Statement * If `CREATE VIEW AS WITH`. * * Used by `CREATE TABLE`, `CREATE VIEW` - * - * @var WithStatement|null */ - public $with; + public WithStatement|null $with = null; /** * If `CREATE TABLE ... SELECT`. * If `CREATE VIEW AS ` ... SELECT`. * * Used by `CREATE TABLE`, `CREATE VIEW` - * - * @var SelectStatement|null */ - public $select; + public SelectStatement|null $select = null; /** * If `CREATE TABLE ... LIKE`. * * Used by `CREATE TABLE` - * - * @var Expression|null */ - public $like; + public Expression|null $like = null; /** * Expression used for partitioning. - * - * @var string|null */ - public $partitionBy; + public string|null $partitionBy = null; /** * The number of partitions. - * - * @var int|null */ - public $partitionsNum; + public int|null $partitionsNum = null; /** * Expression used for subpartitioning. - * - * @var string|null */ - public $subpartitionBy; + public string|null $subpartitionBy = null; /** * The number of subpartitions. - * - * @var int|null */ - public $subpartitionsNum; + public int|null $subpartitionsNum = null; /** * The partition of the new table. * * @var PartitionDefinition[]|null */ - public $partitions; + public array|null $partitions = null; /** * If `CREATE TRIGGER` the name of the table. * * Used by `CREATE TRIGGER`. - * - * @var Expression|null */ - public $table; + public Expression|null $table = null; /** * The return data type of this routine. * * Used by `CREATE FUNCTION`. - * - * @var DataType|null */ - public $return; + public DataType|null $return = null; /** * The parameters of this routine. @@ -384,7 +364,7 @@ class CreateStatement extends Statement * * @var ParameterDefinition[]|null */ - public $parameters; + public array|null $parameters = null; /** * The body of this function or procedure. @@ -398,10 +378,10 @@ class CreateStatement extends Statement public function build(): string { $fields = ''; - if (! empty($this->fields)) { + if ($this->fields !== null && $this->fields !== []) { if (is_array($this->fields)) { $fields = CreateDefinition::buildAll($this->fields) . ' '; - } elseif ($this->fields instanceof ArrayObj) { + } else { $fields = $this->fields->build(); } } @@ -589,7 +569,7 @@ public function parse(Parser $parser, TokensList $list): void } } else { $this->fields = CreateDefinition::parse($parser, $list); - if (empty($this->fields)) { + if ($this->fields === []) { $parser->error('At least one column definition was expected.', $list->tokens[$list->idx]); } diff --git a/src/Statements/DeleteStatement.php b/src/Statements/DeleteStatement.php index e348feb2..e06cbcfb 100644 --- a/src/Statements/DeleteStatement.php +++ b/src/Statements/DeleteStatement.php @@ -51,7 +51,7 @@ class DeleteStatement extends Statement * @var array> * @psalm-var array 1, 'QUICK' => 2, 'IGNORE' => 3, @@ -65,7 +65,7 @@ class DeleteStatement extends Statement * @var array> * @psalm-var array */ - public static $clauses = [ + public static array $clauses = [ 'DELETE' => [ 'DELETE', 2, @@ -131,10 +131,8 @@ class DeleteStatement extends Statement /** * Partitions used as source for this statement. - * - * @var ArrayObj|null */ - public $partition; + public ArrayObj|null $partition = null; /** * Conditions used for filtering each row of the result set. @@ -152,10 +150,8 @@ class DeleteStatement extends Statement /** * Conditions used for limiting the size of the result set. - * - * @var Limit|null */ - public $limit; + public Limit|null $limit = null; public function build(): string { diff --git a/src/Statements/DropStatement.php b/src/Statements/DropStatement.php index c6fdbd11..bd42b9cc 100644 --- a/src/Statements/DropStatement.php +++ b/src/Statements/DropStatement.php @@ -18,7 +18,7 @@ class DropStatement extends Statement * @var array> * @psalm-var array 1, 'EVENT' => 1, 'FUNCTION' => 1, @@ -45,7 +45,7 @@ class DropStatement extends Statement * @var array> * @psalm-var array */ - public static $clauses = [ + public static array $clauses = [ 'DROP' => [ 'DROP', 2, @@ -71,12 +71,10 @@ class DropStatement extends Statement * * @var Expression[]|null */ - public $fields; + public array|null $fields = null; /** * Table of the dropped index. - * - * @var Expression|null */ - public $table; + public Expression|null $table = null; } diff --git a/src/Statements/ExplainStatement.php b/src/Statements/ExplainStatement.php index b0130388..82308419 100644 --- a/src/Statements/ExplainStatement.php +++ b/src/Statements/ExplainStatement.php @@ -33,48 +33,36 @@ class ExplainStatement extends Statement /** * The parser of the statement to be explained - * - * @var Parser|null */ - public $bodyParser = null; + public Parser|null $bodyParser = null; /** * The statement alias, could be any of the following: * - {EXPLAIN | DESCRIBE | DESC} * - {EXPLAIN | DESCRIBE | DESC} ANALYZE * - ANALYZE - * - * @var string */ - public $statementAlias; + public string $statementAlias; /** * The connection identifier, if used. - * - * @var int|null */ - public $connectionId = null; + public int|null $connectionId = null; /** * The explained database for the table's name, if used. - * - * @var string|null */ - public $explainedDatabase = null; + public string|null $explainedDatabase = null; /** * The explained table's name, if used. - * - * @var string|null */ - public $explainedTable = null; + public string|null $explainedTable = null; /** * The explained column's name, if used. - * - * @var string|null */ - public $explainedColumn = null; + public string|null $explainedColumn = null; /** * @param Parser $parser the instance that requests parsing @@ -227,8 +215,8 @@ public function parse(Parser $parser, TokensList $list): void continue; } - if ($this->explainedColumn === null) { - $this->explainedColumn = $token->value; + if ($this->explainedColumn === null && $token->value !== null) { + $this->explainedColumn = (string) $token->value; } } } diff --git a/src/Statements/InsertStatement.php b/src/Statements/InsertStatement.php index 6c7e83b8..2b5988a2 100644 --- a/src/Statements/InsertStatement.php +++ b/src/Statements/InsertStatement.php @@ -58,7 +58,7 @@ class InsertStatement extends Statement * @var array> * @psalm-var array 1, 'DELAYED' => 2, 'HIGH_PRIORITY' => 3, @@ -67,10 +67,8 @@ class InsertStatement extends Statement /** * Tables used as target for this statement. - * - * @var IntoKeyword|null */ - public $into; + public IntoKeyword|null $into = null; /** * Values to be inserted. @@ -90,18 +88,14 @@ class InsertStatement extends Statement /** * If SELECT clause is present * holds the SelectStatement. - * - * @var SelectStatement|null */ - public $select; + public SelectStatement|null $select = null; /** * If WITH CTE is present * holds the WithStatement. - * - * @var WithStatement|null */ - public $with; + public WithStatement|null $with = null; /** * If ON DUPLICATE KEY UPDATE clause is present diff --git a/src/Statements/LoadStatement.php b/src/Statements/LoadStatement.php index 61f6adea..ecf15601 100644 --- a/src/Statements/LoadStatement.php +++ b/src/Statements/LoadStatement.php @@ -46,7 +46,7 @@ class LoadStatement extends Statement * @var array> * @psalm-var array 1, 'CONCURRENT' => 1, 'LOCAL' => 2, @@ -87,56 +87,42 @@ class LoadStatement extends Statement /** * File name being used to load data. - * - * @var Expression|null */ - public $fileName; + public Expression|null $fileName = null; /** * Table used as destination for this statement. - * - * @var Expression|null */ - public $table; + public Expression|null $table = null; /** * Partitions used as source for this statement. - * - * @var ArrayObj|null */ - public $partition; + public ArrayObj|null $partition = null; /** * Character set used in this statement. - * - * @var Expression|null */ - public $charsetName; + public Expression|null $charsetName = null; /** * Options for FIELDS/COLUMNS keyword. * * @see LoadStatement::STATEMENT_FIELDS_OPTIONS - * - * @var OptionsArray|null */ - public $fieldsOptions; + public OptionsArray|null $fieldsOptions = null; /** * Whether to use `FIELDS` or `COLUMNS` while building. - * - * @var string|null */ - public $fieldsKeyword; + public string|null $fieldsKeyword = null; /** * Options for OPTIONS keyword. * * @see LoadStatement::STATEMENT_LINES_OPTIONS - * - * @var OptionsArray|null */ - public $linesOptions; + public OptionsArray|null $linesOptions = null; /** * Column names or user variables. @@ -154,24 +140,18 @@ class LoadStatement extends Statement /** * Ignore 'number' LINES/ROWS. - * - * @var Expression|null */ - public $ignoreNumber; + public Expression|null $ignoreNumber = null; /** * REPLACE/IGNORE Keyword. - * - * @var string|null */ - public $replaceIgnore; + public string|null $replaceIgnore = null; /** * LINES/ROWS Keyword. - * - * @var string|null */ - public $linesRows; + public string|null $linesRows = null; public function build(): string { diff --git a/src/Statements/LockStatement.php b/src/Statements/LockStatement.php index 1c1b877e..eb55b5c1 100644 --- a/src/Statements/LockStatement.php +++ b/src/Statements/LockStatement.php @@ -22,15 +22,13 @@ class LockStatement extends Statement * * @var LockExpression[] */ - public $locked = []; + public array $locked = []; /** * Whether it's a LOCK statement * if false, it's an UNLOCK statement - * - * @var bool */ - public $isLock = true; + public bool $isLock = true; /** * @param Parser $parser the instance that requests parsing diff --git a/src/Statements/MaintenanceStatement.php b/src/Statements/MaintenanceStatement.php index 14009350..e853d83e 100644 --- a/src/Statements/MaintenanceStatement.php +++ b/src/Statements/MaintenanceStatement.php @@ -24,7 +24,7 @@ class MaintenanceStatement extends Statement * * @var Expression[]|null */ - public $tables; + public array|null $tables = null; /** * Function called after the token was processed. diff --git a/src/Statements/NotImplementedStatement.php b/src/Statements/NotImplementedStatement.php index f12851ce..12e904ee 100644 --- a/src/Statements/NotImplementedStatement.php +++ b/src/Statements/NotImplementedStatement.php @@ -22,7 +22,7 @@ class NotImplementedStatement extends Statement * * @var Token[] */ - public $unknown = []; + public array $unknown = []; public function build(): string { diff --git a/src/Statements/OptimizeStatement.php b/src/Statements/OptimizeStatement.php index 6f9bede2..ce09fbec 100644 --- a/src/Statements/OptimizeStatement.php +++ b/src/Statements/OptimizeStatement.php @@ -21,7 +21,7 @@ class OptimizeStatement extends Statement * @var array> * @psalm-var array 1, 'NO_WRITE_TO_BINLOG' => 2, @@ -33,5 +33,5 @@ class OptimizeStatement extends Statement * * @var Expression[]|null */ - public $tables; + public array|null $tables = null; } diff --git a/src/Statements/PurgeStatement.php b/src/Statements/PurgeStatement.php index b0255f0d..67800b5e 100644 --- a/src/Statements/PurgeStatement.php +++ b/src/Statements/PurgeStatement.php @@ -24,24 +24,18 @@ class PurgeStatement extends Statement { /** * The type of logs - * - * @var string|null */ - public $logType; + public string|null $logType = null; /** * The end option of this query. - * - * @var string|null */ - public $endOption; + public string|null $endOption = null; /** * The end expr of this query. - * - * @var string|null */ - public $endExpr; + public Expression|null $endExpr = null; public function build(): string { diff --git a/src/Statements/RenameStatement.php b/src/Statements/RenameStatement.php index 126ad872..3b83f83f 100644 --- a/src/Statements/RenameStatement.php +++ b/src/Statements/RenameStatement.php @@ -24,7 +24,7 @@ class RenameStatement extends Statement * * @var RenameOperation[]|null */ - public $renames; + public array|null $renames = null; /** * Function called before the token is processed. diff --git a/src/Statements/RepairStatement.php b/src/Statements/RepairStatement.php index 0b1d232b..8ebb090a 100644 --- a/src/Statements/RepairStatement.php +++ b/src/Statements/RepairStatement.php @@ -19,7 +19,7 @@ class RepairStatement extends MaintenanceStatement * @var array> * @psalm-var array 1, 'NO_WRITE_TO_BINLOG' => 2, diff --git a/src/Statements/ReplaceStatement.php b/src/Statements/ReplaceStatement.php index 3de8afee..e0d1dbcf 100644 --- a/src/Statements/ReplaceStatement.php +++ b/src/Statements/ReplaceStatement.php @@ -46,17 +46,15 @@ class ReplaceStatement extends Statement * @var array> * @psalm-var array 1, 'DELAYED' => 1, ]; /** * Tables used as target for this statement. - * - * @var IntoKeyword|null */ - public $into; + public IntoKeyword|null $into = null; /** * Values to be replaced. @@ -76,10 +74,8 @@ class ReplaceStatement extends Statement /** * If SELECT clause is present * holds the SelectStatement. - * - * @var SelectStatement|null */ - public $select; + public SelectStatement|null $select = null; public function build(): string { diff --git a/src/Statements/RestoreStatement.php b/src/Statements/RestoreStatement.php index 3963dd6a..045a1623 100644 --- a/src/Statements/RestoreStatement.php +++ b/src/Statements/RestoreStatement.php @@ -17,7 +17,7 @@ class RestoreStatement extends MaintenanceStatement * @var array> * @psalm-var array 1, 'FROM' => [ diff --git a/src/Statements/SelectStatement.php b/src/Statements/SelectStatement.php index 8677fc5d..e32db3e0 100644 --- a/src/Statements/SelectStatement.php +++ b/src/Statements/SelectStatement.php @@ -53,7 +53,7 @@ class SelectStatement extends Statement * @var array> * @psalm-var array 1, 'DISTINCT' => 1, 'DISTINCTROW' => 1, @@ -86,7 +86,7 @@ class SelectStatement extends Statement * @var array> * @psalm-var array */ - public static $clauses = [ + public static array $clauses = [ 'SELECT' => [ 'SELECT', 2, @@ -242,77 +242,67 @@ class SelectStatement extends Statement * * @var IndexHint[]|null */ - public $indexHints; + public array|null $indexHints = null; /** * Partitions used as source for this statement. - * - * @var ArrayObj|null */ - public $partition; + public ArrayObj|null $partition = null; /** * Conditions used for filtering each row of the result set. * * @var Condition[]|null */ - public $where; + public array|null $where = null; /** * Conditions used for grouping the result set. * * @var GroupKeyword[]|null */ - public $group; + public array|null $group = null; /** * List of options available for the GROUP BY component. - * - * @var OptionsArray|null */ - public $groupOptions; + public OptionsArray|null $groupOptions = null; /** * Conditions used for filtering the result set. * * @var Condition[]|null */ - public $having; + public array|null $having = null; /** * Specifies the order of the rows in the result set. * * @var OrderKeyword[]|null */ - public $order; + public array|null $order = null; /** * Conditions used for limiting the size of the result set. - * - * @var Limit|null */ - public $limit; + public Limit|null $limit = null; /** * Procedure that should process the data in the result set. - * - * @var FunctionCall|null */ - public $procedure; + public FunctionCall|null $procedure = null; /** * Destination of this result set. - * - * @var IntoKeyword|null */ - public $into; + public IntoKeyword|null $into = null; /** * Joins. * * @var JoinKeyword[]|null */ - public $join; + public array|null $join = null; /** * Unions. @@ -325,10 +315,8 @@ class SelectStatement extends Statement * The end options of this query. * * @see SelectStatement::STATEMENT_END_OPTIONS - * - * @var OptionsArray|null */ - public $endOptions; + public OptionsArray|null $endOptions = null; /** * Gets the clauses of this statement. diff --git a/src/Statements/SetStatement.php b/src/Statements/SetStatement.php index 5a66e77f..94d7c948 100644 --- a/src/Statements/SetStatement.php +++ b/src/Statements/SetStatement.php @@ -23,7 +23,7 @@ class SetStatement extends Statement * @var array> * @psalm-var array */ - public static $clauses = [ + public static array $clauses = [ 'SET' => [ 'SET', 3, @@ -40,7 +40,7 @@ class SetStatement extends Statement * @var array> * @psalm-var array [ 3, 'var', @@ -77,26 +77,22 @@ class SetStatement extends Statement /** * Options used in current statement. - * - * @var OptionsArray|null */ - public $options; + public OptionsArray|null $options = null; /** * The end options of this query. * * @see SetStatement::STATEMENT_END_OPTIONS - * - * @var OptionsArray|null */ - public $endOptions; + public OptionsArray|null $endOptions = null; /** * The updated values. * * @var SetOperation[]|null */ - public $set; + public array|null $set = null; public function build(): string { diff --git a/src/Statements/ShowStatement.php b/src/Statements/ShowStatement.php index 676ecbea..9da56bab 100644 --- a/src/Statements/ShowStatement.php +++ b/src/Statements/ShowStatement.php @@ -15,7 +15,7 @@ class ShowStatement extends NotImplementedStatement * @var array> * @psalm-var array 1, 'AUTHORS' => 2, 'BINARY' => 2, diff --git a/src/Statements/TransactionStatement.php b/src/Statements/TransactionStatement.php index f69e752c..7894b41d 100644 --- a/src/Statements/TransactionStatement.php +++ b/src/Statements/TransactionStatement.php @@ -25,24 +25,20 @@ class TransactionStatement extends Statement /** * The type of this query. - * - * @var int|null */ - public $type; + public int|null $type = null; /** * The list of statements in this transaction. * * @var Statement[]|null */ - public $statements; + public array|null $statements = null; /** * The ending transaction statement which may be a `COMMIT` or a `ROLLBACK`. - * - * @var TransactionStatement|null */ - public $end; + public TransactionStatement|null $end = null; /** * Options for this query. @@ -50,7 +46,7 @@ class TransactionStatement extends Statement * @var array> * @psalm-var array 1, 'BEGIN' => 1, 'COMMIT' => 1, diff --git a/src/Statements/TruncateStatement.php b/src/Statements/TruncateStatement.php index 201d3819..2cad3cbd 100644 --- a/src/Statements/TruncateStatement.php +++ b/src/Statements/TruncateStatement.php @@ -18,14 +18,12 @@ class TruncateStatement extends Statement * @var array> * @psalm-var array 1]; + public static array $statementOptions = ['TABLE' => 1]; /** * The name of the truncated table. - * - * @var Expression|null */ - public $table; + public Expression|null $table = null; /** * Special build method for truncate statement as Statement::build would return empty string. diff --git a/src/Statements/UpdateStatement.php b/src/Statements/UpdateStatement.php index aef81014..91d9a4f7 100644 --- a/src/Statements/UpdateStatement.php +++ b/src/Statements/UpdateStatement.php @@ -36,7 +36,7 @@ class UpdateStatement extends Statement * @var array> * @psalm-var array 1, 'IGNORE' => 2, ]; @@ -49,7 +49,7 @@ class UpdateStatement extends Statement * @var array> * @psalm-var array */ - public static $clauses = [ + public static array $clauses = [ 'UPDATE' => [ 'UPDATE', 2, @@ -99,40 +99,38 @@ class UpdateStatement extends Statement * * @var Expression[]|null */ - public $tables; + public array|null $tables = null; /** * The updated values. * * @var SetOperation[]|null */ - public $set; + public array|null $set = null; /** * Conditions used for filtering each row of the result set. * * @var Condition[]|null */ - public $where; + public array|null $where = null; /** * Specifies the order of the rows in the result set. * * @var OrderKeyword[]|null */ - public $order; + public array|null $order = null; /** * Conditions used for limiting the size of the result set. - * - * @var Limit|null */ - public $limit; + public Limit|null $limit = null; /** * Joins. * * @var JoinKeyword[]|null */ - public $join; + public array|null $join = null; } diff --git a/src/Statements/WithStatement.php b/src/Statements/WithStatement.php index 1892c24c..f5210f7f 100644 --- a/src/Statements/WithStatement.php +++ b/src/Statements/WithStatement.php @@ -30,7 +30,7 @@ final class WithStatement extends Statement * @var array> * @psalm-var array 1]; + public static array $statementOptions = ['RECURSIVE' => 1]; /** * The clauses of this statement, in order. @@ -40,7 +40,7 @@ final class WithStatement extends Statement * @var array> * @psalm-var array */ - public static $clauses = [ + public static array $clauses = [ 'WITH' => [ 'WITH', 2, @@ -57,14 +57,12 @@ final class WithStatement extends Statement ]; /** @var WithKeyword[] */ - public $withers = []; + public array $withers = []; /** * holds the CTE parser. - * - * @var Parser|null */ - public $cteStatementParser; + public Parser|null $cteStatementParser = null; /** * @param Parser $parser the instance that requests parsing