> * @psalm-var array 1, 'IGNORE' => 2, ]; /** * The clauses of this statement, in order. * * @see Statement::$clauses * * @var array}> */ public static array $clauses = [ 'UPDATE' => [ 'UPDATE', Statement::ADD_KEYWORD, ], // Used for options. '_OPTIONS' => [ '_OPTIONS', Statement::ADD_CLAUSE, ], // Used for updated tables. '_UPDATE' => [ 'UPDATE', Statement::ADD_CLAUSE, ], 'JOIN' => [ 'JOIN', Statement::ADD_CLAUSE, ], 'LEFT JOIN' => [ 'LEFT JOIN', Statement::ADD_CLAUSE, ], 'INNER JOIN' => [ 'INNER JOIN', Statement::ADD_CLAUSE, ], 'SET' => [ 'SET', Statement::ADD_CLAUSE | Statement::ADD_KEYWORD, ], 'WHERE' => [ 'WHERE', Statement::ADD_CLAUSE | Statement::ADD_KEYWORD, ], 'ORDER BY' => [ 'ORDER BY', Statement::ADD_CLAUSE | Statement::ADD_KEYWORD, ], 'LIMIT' => [ 'LIMIT', Statement::ADD_CLAUSE | Statement::ADD_KEYWORD, ], ]; /** * Tables used as sources for this statement. * * @var Expression[]|null */ public array|null $tables = null; /** * The updated values. * * @var SetOperation[]|null */ public array|null $set = null; /** * Conditions used for filtering each row of the result set. * * @var Condition[]|null */ public array|null $where = null; /** * Specifies the order of the rows in the result set. * * @var OrderKeyword[]|null */ public array|null $order = null; /** * Conditions used for limiting the size of the result set. */ public Limit|null $limit = null; /** * Joins. * * @var JoinKeyword[]|null */ public array|null $join = null; /** * Function called after the token was processed. * In the update statement, this is used to check that at least one assignment has been set to throw an error if a * query like `UPDATE acme SET WHERE 1;` is parsed. * * @throws ParserException throws the exception, if strict mode is enabled. */ public function after(Parser $parser, TokensList $list, Token $token): void { /** @psalm-var string $tokenValue */ $tokenValue = $token->value; // Ensure we finished to parse the "SET" token, and if yes, ensure that assignments are defined. if ($this->set !== [] || (Parser::KEYWORD_PARSERS[$tokenValue]['field'] ?? null) !== 'set') { return; } $parser->error('Missing assignment in SET operation.', $list->tokens[$list->idx]); } }