diff options
Diffstat (limited to 'src/Statements/InsertStatement.php')
-rw-r--r-- | src/Statements/InsertStatement.php | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/src/Statements/InsertStatement.php b/src/Statements/InsertStatement.php index 4e48c0d..6f63235 100644 --- a/src/Statements/InsertStatement.php +++ b/src/Statements/InsertStatement.php @@ -1,13 +1,13 @@ <?php - /** * `INSERT` statement. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Statements; -use PhpMyAdmin\SqlParser\Components\ArrayObj; use PhpMyAdmin\SqlParser\Components\Array2d; +use PhpMyAdmin\SqlParser\Components\ArrayObj; use PhpMyAdmin\SqlParser\Components\IntoKeyword; use PhpMyAdmin\SqlParser\Components\OptionsArray; use PhpMyAdmin\SqlParser\Components\SetOperation; @@ -48,10 +48,6 @@ use PhpMyAdmin\SqlParser\TokensList; * [ ON DUPLICATE KEY UPDATE * col_name=expr * [, col_name=expr] ... ] - * - * @category Statements - * - * @license https://www.gnu.org/licenses/gpl-2.0.txt GPL-2.0+ */ class InsertStatement extends Statement { @@ -60,12 +56,12 @@ class InsertStatement extends Statement * * @var array */ - public static $OPTIONS = array( + public static $OPTIONS = [ 'LOW_PRIORITY' => 1, 'DELAYED' => 2, 'HIGH_PRIORITY' => 3, - 'IGNORE' => 4 - ); + 'IGNORE' => 4, + ]; /** * Tables used as target for this statement. @@ -113,15 +109,15 @@ class InsertStatement extends Statement $ret = 'INSERT ' . $this->options; $ret = trim($ret) . ' INTO ' . $this->into; - if (! is_null($this->values) && count($this->values) > 0) { + if ($this->values !== null && count($this->values) > 0) { $ret .= ' VALUES ' . Array2d::build($this->values); - } elseif (! is_null($this->set) && count($this->set) > 0) { + } elseif ($this->set !== null && count($this->set) > 0) { $ret .= ' SET ' . SetOperation::build($this->set); - } elseif (! is_null($this->select) && strlen($this->select) > 0) { + } elseif ($this->select !== null && strlen((string) $this->select) > 0) { $ret .= ' ' . $this->select->build(); } - if (! is_null($this->onDuplicateSet) && count($this->onDuplicateSet) > 0) { + if ($this->onDuplicateSet !== null && count($this->onDuplicateSet) > 0) { $ret .= ' ON DUPLICATE KEY UPDATE ' . SetOperation::build($this->onDuplicateSet); } @@ -195,7 +191,7 @@ class InsertStatement extends Statement $this->into = IntoKeyword::parse( $parser, $list, - array('fromInsert' => true) + ['fromInsert' => true] ); $state = 1; |