summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/Components/Expression.php2
-rw-r--r--src/Components/SetOperation.php2
-rw-r--r--src/Statements/CreateStatement.php10
-rw-r--r--src/Statements/DeleteStatement.php14
-rw-r--r--src/Statements/InsertStatement.php8
-rw-r--r--src/Statements/ReplaceStatement.php6
-rw-r--r--src/Translator.php4
-rw-r--r--src/Utils/Formatter.php4
-rw-r--r--tests/Lexer/ContextTest.php2
9 files changed, 26 insertions, 26 deletions
diff --git a/src/Components/Expression.php b/src/Components/Expression.php
index 108f335..2c22241 100644
--- a/src/Components/Expression.php
+++ b/src/Components/Expression.php
@@ -436,7 +436,7 @@ class Expression extends Component
return implode(', ', $component);
}
- if ($component->expr !== '' && ! is_null($component->expr)) {
+ if ($component->expr !== '' && $component->expr !== null) {
$ret = $component->expr;
} else {
$fields = [];
diff --git a/src/Components/SetOperation.php b/src/Components/SetOperation.php
index 2d76704..eef0f80 100644
--- a/src/Components/SetOperation.php
+++ b/src/Components/SetOperation.php
@@ -122,7 +122,7 @@ class SetOperation extends Component
'breakOnAlias' => true,
]
);
- if (is_null($tmp)) {
+ if ($tmp === null) {
$parser->error('Missing expression.', $token);
break;
}
diff --git a/src/Statements/CreateStatement.php b/src/Statements/CreateStatement.php
index da21b42..300e779 100644
--- a/src/Statements/CreateStatement.php
+++ b/src/Statements/CreateStatement.php
@@ -388,12 +388,12 @@ class CreateStatement extends Statement
. Expression::build($this->name) . ' '
. OptionsArray::build($this->entityOptions);
} elseif ($this->options->has('TABLE')) {
- if (! is_null($this->select)) {
+ if ($this->select !== null) {
return 'CREATE '
. OptionsArray::build($this->options) . ' '
. Expression::build($this->name) . ' '
. $this->select->build();
- } elseif (! is_null($this->like)) {
+ } elseif ($this->like !== null) {
return 'CREATE '
. OptionsArray::build($this->options) . ' '
. Expression::build($this->name) . ' LIKE '
@@ -530,7 +530,7 @@ class CreateStatement extends Statement
]
);
// The 'LIKE' keyword was found, but no table_name was found next to it
- if (is_null($this->like)) {
+ if ($this->like === null) {
$parser->error(
'A table name was expected.',
$list->tokens[$list->idx]
@@ -653,10 +653,10 @@ class CreateStatement extends Statement
if ($this->options->has('FUNCTION')) {
$prev_token = $token;
$token = $list->getNextOfType(Token::TYPE_KEYWORD);
- if (is_null($token) || $token->keyword !== 'RETURNS') {
+ if ($token === null || $token->keyword !== 'RETURNS') {
$parser->error(
'A "RETURNS" keyword was expected.',
- is_null($token) ? $prev_token : $token
+ $token ?? $prev_token
);
} else {
++$list->idx;
diff --git a/src/Statements/DeleteStatement.php b/src/Statements/DeleteStatement.php
index b55d5f4..4657411 100644
--- a/src/Statements/DeleteStatement.php
+++ b/src/Statements/DeleteStatement.php
@@ -166,25 +166,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((string) $this->limit) > 0) {
+ if ($this->limit !== null && strlen((string) $this->limit) > 0) {
$ret .= ' LIMIT ' . Limit::build($this->limit);
}
diff --git a/src/Statements/InsertStatement.php b/src/Statements/InsertStatement.php
index 383b025..ab2149c 100644
--- a/src/Statements/InsertStatement.php
+++ b/src/Statements/InsertStatement.php
@@ -113,15 +113,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((string) $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);
}
diff --git a/src/Statements/ReplaceStatement.php b/src/Statements/ReplaceStatement.php
index 5bb5e12..0bbe117 100644
--- a/src/Statements/ReplaceStatement.php
+++ b/src/Statements/ReplaceStatement.php
@@ -90,11 +90,11 @@ class ReplaceStatement extends Statement
$ret = 'REPLACE ' . $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((string) $this->select) > 0) {
+ } elseif ($this->select !== null && strlen((string) $this->select) > 0) {
$ret .= ' ' . $this->select->build();
}
diff --git a/src/Translator.php b/src/Translator.php
index 2c28370..36c519f 100644
--- a/src/Translator.php
+++ b/src/Translator.php
@@ -29,7 +29,7 @@ class Translator
*/
public static function load()
{
- if (is_null(self::$loader)) {
+ if (self::$loader === null) {
// Create loader object
self::$loader = new Loader();
@@ -45,7 +45,7 @@ class Translator
self::$loader->bindtextdomain('sqlparser', __DIR__ . '/../locale/');
}
- if (is_null(self::$translator)) {
+ if (self::$translator === null) {
// Get translator
self::$translator = self::$loader->getTranslator();
}
diff --git a/src/Utils/Formatter.php b/src/Utils/Formatter.php
index 3b17a2b..f4d9576 100644
--- a/src/Utils/Formatter.php
+++ b/src/Utils/Formatter.php
@@ -99,11 +99,11 @@ class Formatter
$options['formats'] = $this->getDefaultFormats();
}
- if (is_null($options['line_ending'])) {
+ if ($options['line_ending'] === null) {
$options['line_ending'] = $options['type'] === 'html' ? '<br/>' : "\n";
}
- if (is_null($options['indentation'])) {
+ if ($options['indentation'] === null) {
$options['indentation'] = $options['type'] === 'html' ? '&nbsp;&nbsp;&nbsp;&nbsp;' : ' ';
}
diff --git a/tests/Lexer/ContextTest.php b/tests/Lexer/ContextTest.php
index d713059..7897684 100644
--- a/tests/Lexer/ContextTest.php
+++ b/tests/Lexer/ContextTest.php
@@ -31,7 +31,7 @@ class ContextTest extends TestCase
public function testLoadClosest($context, $expected)
{
$this->assertEquals($expected, Context::loadClosest($context));
- if (! is_null($expected)) {
+ if ($expected !== null) {
$this->assertEquals('\\PhpMyAdmin\\SqlParser\\Contexts\\Context' . $expected, Context::$loadedContext);
$this->assertTrue(class_exists(Context::$loadedContext));
}