diff options
Diffstat (limited to 'src/Statements/DeleteStatement.php')
-rw-r--r-- | src/Statements/DeleteStatement.php | 63 |
1 files changed, 29 insertions, 34 deletions
diff --git a/src/Statements/DeleteStatement.php b/src/Statements/DeleteStatement.php index 088489d..57e100b 100644 --- a/src/Statements/DeleteStatement.php +++ b/src/Statements/DeleteStatement.php @@ -1,8 +1,8 @@ <?php - /** * `DELETE` statement. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Statements; @@ -41,11 +41,6 @@ use PhpMyAdmin\SqlParser\TokensList; * FROM tbl_name[.*] [, tbl_name[.*]] ... * USING table_references * [WHERE where_condition] - * - * - * @category Statements - * - * @license https://www.gnu.org/licenses/gpl-2.0.txt GPL-2.0+ */ class DeleteStatement extends Statement { @@ -54,11 +49,11 @@ class DeleteStatement extends Statement * * @var array */ - public static $OPTIONS = array( + public static $OPTIONS = [ 'LOW_PRIORITY' => 1, 'QUICK' => 2, - 'IGNORE' => 3 - ); + 'IGNORE' => 3, + ]; /** * The clauses of this statement, in order. @@ -67,41 +62,41 @@ class DeleteStatement extends Statement * * @var array */ - public static $CLAUSES = array( - 'DELETE' => array( + public static $CLAUSES = [ + 'DELETE' => [ 'DELETE', 2, - ), + ], // Used for options. - '_OPTIONS' => array( + '_OPTIONS' => [ '_OPTIONS', 1, - ), - 'FROM' => array( + ], + 'FROM' => [ 'FROM', 3, - ), - 'PARTITION' => array( + ], + 'PARTITION' => [ 'PARTITION', 3, - ), - 'USING' => array( + ], + 'USING' => [ 'USING', 3, - ), - 'WHERE' => array( + ], + 'WHERE' => [ 'WHERE', 3, - ), - 'ORDER BY' => array( + ], + 'ORDER BY' => [ 'ORDER BY', 3, - ), - 'LIMIT' => array( + ], + 'LIMIT' => [ 'LIMIT', 3, - ) - ); + ], + ]; /** * Table(s) used as sources for this statement. @@ -166,25 +161,25 @@ class DeleteStatement extends Statement { $ret = 'DELETE ' . OptionsArray::build($this->options); - if (! is_null($this->columns) && count($this->columns) > 0) { + if ($this->columns !== null && count($this->columns) > 0) { $ret .= ' ' . ExpressionArray::build($this->columns); } - if (! is_null($this->from) && count($this->from) > 0) { + if ($this->from !== null && count($this->from) > 0) { $ret .= ' FROM ' . ExpressionArray::build($this->from); } - if (! is_null($this->join) && count($this->join) > 0) { + if ($this->join !== null && count($this->join) > 0) { $ret .= ' ' . JoinKeyword::build($this->join); } - if (! is_null($this->using) && count($this->using) > 0) { + if ($this->using !== null && count($this->using) > 0) { $ret .= ' USING ' . ExpressionArray::build($this->using); } - if (! is_null($this->where) && count($this->where) > 0) { + if ($this->where !== null && count($this->where) > 0) { $ret .= ' WHERE ' . Condition::build($this->where); } - if (! is_null($this->order) && count($this->order) > 0) { + if ($this->order !== null && count($this->order) > 0) { $ret .= ' ORDER BY ' . ExpressionArray::build($this->order); } - if (! is_null($this->limit) && strlen($this->limit) > 0) { + if ($this->limit !== null && strlen((string) $this->limit) > 0) { $ret .= ' LIMIT ' . Limit::build($this->limit); } |