summaryrefslogtreecommitdiffstats
path: root/src/Utils
diff options
context:
space:
mode:
authorBruno Perel <brunoperel@gmail.com>2018-11-26 20:02:58 +0100
committerBruno Perel <brunoperel@gmail.com>2018-11-26 20:09:00 +0100
commitef7968e5a80de41c2bbd5ad3d93b6f47fe3f9705 (patch)
treed1025e7c4f85973ef4a92789eafb825b70ce4472 /src/Utils
parent513ed8175bdc0fc17a192ea29757cf8fee178c2a (diff)
downloadsql-parser-ef7968e5a80de41c2bbd5ad3d93b6f47fe3f9705.zip
sql-parser-ef7968e5a80de41c2bbd5ad3d93b6f47fe3f9705.tar.gz
sql-parser-ef7968e5a80de41c2bbd5ad3d93b6f47fe3f9705.tar.bz2
Use triple (in)equalities when type compatibility is ensured
Diffstat (limited to 'src/Utils')
-rw-r--r--src/Utils/BufferedQuery.php4
-rw-r--r--src/Utils/CLI.php2
-rw-r--r--src/Utils/Formatter.php6
-rw-r--r--src/Utils/Query.php4
4 files changed, 8 insertions, 8 deletions
diff --git a/src/Utils/BufferedQuery.php b/src/Utils/BufferedQuery.php
index 9b0cda7..ee0dca4 100644
--- a/src/Utils/BufferedQuery.php
+++ b/src/Utils/BufferedQuery.php
@@ -191,7 +191,7 @@ class BufferedQuery
* treated differently, because of the preceding backslash, it will
* be ignored.
*/
- if ((($this->status & static::STATUS_COMMENT) == 0) && ($this->query[$i] === '\\')) {
+ if ((($this->status & static::STATUS_COMMENT) === 0) && ($this->query[$i] === '\\')) {
$this->current .= $this->query[$i] . $this->query[++$i];
continue;
}
@@ -319,7 +319,7 @@ class BufferedQuery
}
// Checking if the delimiter definition ended.
- if (($delimiter != '')
+ if (($delimiter !== '')
&& ((($i < $len) && Context::isWhitespace($this->query[$i]))
|| (($i === $len) && $end))
) {
diff --git a/src/Utils/CLI.php b/src/Utils/CLI.php
index d412789..3dc48a6 100644
--- a/src/Utils/CLI.php
+++ b/src/Utils/CLI.php
@@ -120,7 +120,7 @@ class CLI
$lexer = new Lexer($params['q'], false);
$parser = new Parser($lexer->list);
$errors = Error::get(array($lexer, $parser));
- if (count($errors) == 0) {
+ if (count($errors) === 0) {
return 0;
}
$output = Error::format($errors);
diff --git a/src/Utils/Formatter.php b/src/Utils/Formatter.php
index 4bfdc26..c41c69c 100644
--- a/src/Utils/Formatter.php
+++ b/src/Utils/Formatter.php
@@ -554,7 +554,7 @@ class Formatter
if ($this->options['type'] === 'html') {
return '<span ' . $format['html'] . '>' . htmlspecialchars($text, ENT_NOQUOTES) . '</span>';
} elseif ($this->options['type'] === 'cli') {
- if ($prev != $format['cli']) {
+ if ($prev !== $format['cli']) {
$prev = $format['cli'];
return $format['cli'] . $this->escapeConsole($text);
@@ -568,7 +568,7 @@ class Formatter
}
if ($this->options['type'] === 'cli') {
- if ($prev != "\x1b[39m") {
+ if ($prev !== "\x1b[39m") {
$prev = "\x1b[39m";
return "\x1b[39m" . $this->escapeConsole($text);
@@ -633,7 +633,7 @@ class Formatter
++$count;
} elseif ($list->tokens[$idx]->value === ')') {
--$count;
- if ($count == 0) {
+ if ($count === 0) {
break;
}
}
diff --git a/src/Utils/Query.php b/src/Utils/Query.php
index 7a8f462..f928ab3 100644
--- a/src/Utils/Query.php
+++ b/src/Utils/Query.php
@@ -633,7 +633,7 @@ class Query
&& ($clauses[$token->keyword] >= $currIdx)
) {
$currIdx = $clauses[$token->keyword];
- if ($skipFirst && ($currIdx == $clauseIdx)) {
+ if ($skipFirst && ($currIdx === $clauseIdx)) {
// This token is skipped (not added to the old
// clause) because it will be replaced.
continue;
@@ -843,7 +843,7 @@ class Query
}
}
- if ($brackets == 0) {
+ if ($brackets === 0) {
if (($token->type === Token::TYPE_KEYWORD)
&& isset($clauses[$token->keyword])
&& ($clause === $token->keyword)