GeezerVison is showing github.com — Use triple (in)equalities when type compatibility is ensured · phpmyadmin/sql-parser@ef7968e
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: src/Components/AlterOperation.php +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -236,7 +236,7 @@ public static function parse(Parser $parser, TokensList $list, array $options = | 236 | 236 | // We have reached the end of ALTER operation and suddenly found | 237 | 237 | // a start to new statement, but have not find a delimiter between them | 238 | 238 |
| 239 | | - if (!($token->value == 'SET' && $list->tokens[$list->idx - 1]->value == 'CHARACTER')) { | | 239 | + if (!($token->value === 'SET' && $list->tokens[$list->idx - 1]->value === 'CHARACTER')) { | 240 | 240 | $parser->error( | 241 | 241 | 'A new statement was found, but no delimiter between it and the previous one.', | 242 | 242 | $token | |
Collapse file Copy file name to clipboardExpand all lines: src/Components/Array2d.php +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -82,7 +82,7 @@ public static function parse(Parser $parser, TokensList $list, array $options = | 82 | 82 | $arrCount = count($arr->values); | 83 | 83 | if ($count === -1) { | 84 | 84 | $count = $arrCount; | 85 | | - } elseif ($arrCount != $count) { | | 85 | + } elseif ($arrCount !== $count) { | 86 | 86 | $parser->error( | 87 | 87 | sprintf( | 88 | 88 | Translator::gettext('%1$d values were expected, but found %2$d.'), | |
Collapse file Copy file name to clipboardExpand all lines: src/Components/Condition.php +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -179,7 +179,7 @@ public static function parse(Parser $parser, TokensList $list, array $options = | 179 | 179 | if ($token->value === '(') { | 180 | 180 | ++$brackets; | 181 | 181 | } elseif ($token->value === ')') { | 182 | | - if ($brackets == 0) { | | 182 | + if ($brackets === 0) { | 183 | 183 | break; | 184 | 184 | } | 185 | 185 | --$brackets; | |
Collapse file Copy file name to clipboardExpand all lines: src/Components/Expression.php +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -299,7 +299,7 @@ public static function parse(Parser $parser, TokensList $list, array $options = | 299 | 299 | $ret->function = $prev[1]->value; | 300 | 300 | } | 301 | 301 | } elseif ($token->value === ')') { | 302 | | - if ($brackets == 0) { | | 302 | + if ($brackets === 0) { | 303 | 303 | // Not our bracket | 304 | 304 | break; | 305 | 305 | } else { | |
Collapse file Copy file name to clipboardExpand all lines: src/Components/IntoKeyword.php +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -207,10 +207,10 @@ public static function parse(Parser $parser, TokensList $list, array $options = | 207 | 207 | $ret->dest = $token->value; | 208 | 208 |
| 209 | 209 | $state = 3; | 210 | | - } elseif ($state == 3) { | | 210 | + } elseif ($state === 3) { | 211 | 211 | $ret->parseFileOptions($parser, $list, $token->value); | 212 | 212 | $state = 4; | 213 | | - } elseif ($state == 4) { | | 213 | + } elseif ($state === 4) { | 214 | 214 | if ($token->type === Token::TYPE_KEYWORD && $token->keyword !== 'LINES') { | 215 | 215 | break; | 216 | 216 | } | |
Collapse file Copy file name to clipboardExpand all lines: src/Components/OptionsArray.php +4-4Lines changed: 4 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -247,10 +247,10 @@ public static function parse(Parser $parser, TokensList $list, array $options = | 247 | 247 | */ | 248 | 248 | if ($state === 1 | 249 | 249 | && $lastOption | 250 | | - && ($lastOption[1] == 'expr' | 251 | | - || $lastOption[1] == 'var' | 252 | | - || $lastOption[1] == 'var=' | 253 | | - || $lastOption[1] == 'expr=') | | 250 | + && ($lastOption[1] === 'expr' | | 251 | + || $lastOption[1] === 'var' | | 252 | + || $lastOption[1] === 'var=' | | 253 | + || $lastOption[1] === 'expr=') | 254 | 254 | ) { | 255 | 255 | $parser->error( | 256 | 256 | sprintf( | |
Collapse file Copy file name to clipboardExpand all lines: src/Components/SetOperation.php +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -94,7 +94,7 @@ public static function parse(Parser $parser, TokensList $list, array $options = | 94 | 94 | // No keyword is expected. | 95 | 95 | if (($token->type === Token::TYPE_KEYWORD) | 96 | 96 | && ($token->flags & Token::FLAG_KEYWORD_RESERVED) | 97 | | - && ($state == 0) | | 97 | + && ($state === 0) | 98 | 98 | ) { | 99 | 99 | break; | 100 | 100 | } | @@ -113,7 +113,7 @@ public static function parse(Parser $parser, TokensList $list, array $options = | 113 | 113 | 'breakOnAlias' => true, | 114 | 114 | ) | 115 | 115 | ); | 116 | | - if ($tmp == null) { | | 116 | + if (is_null($tmp)) { | 117 | 117 | $parser->error('Missing expression.', $token); | 118 | 118 | break; | 119 | 119 | } | |
Collapse file Copy file name to clipboardExpand all lines: src/Context.php +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -313,7 +313,7 @@ public static function isWhitespace($str) | 313 | 313 | public static function isComment($str, $end = false) | 314 | 314 | { | 315 | 315 | $len = strlen($str); | 316 | | - if ($len == 0) { | | 316 | + if ($len === 0) { | 317 | 317 | return null; | 318 | 318 | } | 319 | 319 | if ($str[0] === '#') { | @@ -382,7 +382,7 @@ public static function isNumber($str) | 382 | 382 | */ | 383 | 383 | public static function isSymbol($str) | 384 | 384 | { | 385 | | - if (strlen($str) == 0) { | | 385 | + if (strlen($str) === 0) { | 386 | 386 | return null; | 387 | 387 | } | 388 | 388 | if ($str[0] === '@') { | @@ -408,7 +408,7 @@ public static function isSymbol($str) | 408 | 408 | */ | 409 | 409 | public static function isString($str) | 410 | 410 | { | 411 | | - if (strlen($str) == 0) { | | 411 | + if (strlen($str) === 0) { | 412 | 412 | return null; | 413 | 413 | } | 414 | 414 | if ($str[0] === '\'') { | |
Collapse file Copy file name to clipboardExpand all lines: src/Statement.php +4-6Lines changed: 4 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -451,9 +451,7 @@ public function validateClauseOrder($parser, $list) | 451 | 451 | { | 452 | 452 | $clauses = array_flip(array_keys($this->getClauses())); | 453 | 453 |
| 454 | | - if (empty($clauses) | 455 | | - || count($clauses) == 0 | 456 | | - ) { | | 454 | + if (empty($clauses) || count($clauses) === 0) { | 457 | 455 | return true; | 458 | 456 | } | 459 | 457 |
| @@ -489,7 +487,7 @@ public function validateClauseOrder($parser, $list) | 489 | 487 | ); | 490 | 488 |
| 491 | 489 | // Handle ordering of Multiple Joins in a query | 492 | | - if ($clauseStartIdx != -1) { | | 490 | + if ($clauseStartIdx !== -1) { | 493 | 491 | if ($minJoin === 0 && stripos($clauseType, 'JOIN')) { | 494 | 492 | // First JOIN clause is detected | 495 | 493 | $minJoin = $maxJoin = $clauseStartIdx; | @@ -501,7 +499,7 @@ public function validateClauseOrder($parser, $list) | 501 | 499 | } | 502 | 500 | } | 503 | 501 |
| 504 | | - if ($clauseStartIdx != -1 && $clauseStartIdx < $minIdx) { | | 502 | + if ($clauseStartIdx !== -1 && $clauseStartIdx < $minIdx) { | 505 | 503 | if ($minJoin === 0 || $error === 1) { | 506 | 504 | $token = $list->tokens[$clauseStartIdx]; | 507 | 505 | $parser->error( | @@ -512,7 +510,7 @@ public function validateClauseOrder($parser, $list) | 512 | 510 | return false; | 513 | 511 | } | 514 | 512 | $minIdx = $clauseStartIdx; | 515 | | - } elseif ($clauseStartIdx != -1) { | | 513 | + } elseif ($clauseStartIdx !== -1) { | 516 | 514 | $minIdx = $clauseStartIdx; | 517 | 515 | } | 518 | 516 |
| |
Collapse file Copy file name to clipboardExpand all lines: src/Statements/CreateStatement.php +9-9Lines changed: 9 additions & 9 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -388,7 +388,7 @@ public function parse(Parser $parser, TokensList $list) | 388 | 388 | */ | 389 | 389 | $token = $list->tokens[$list->idx]; | 390 | 390 | $nextidx = $list->idx + 1; | 391 | | - while ($nextidx < $list->count && $list->tokens[$nextidx]->type == Token::TYPE_WHITESPACE) { | | 391 | + while ($nextidx < $list->count && $list->tokens[$nextidx]->type === Token::TYPE_WHITESPACE) { | 392 | 392 | ++$nextidx; | 393 | 393 | } | 394 | 394 |
| @@ -399,18 +399,18 @@ public function parse(Parser $parser, TokensList $list) | 399 | 399 | static::$DB_OPTIONS | 400 | 400 | ); | 401 | 401 | } elseif ($this->options->has('TABLE')) { | 402 | | - if (($token->type == Token::TYPE_KEYWORD) | 403 | | - && ($token->keyword == 'SELECT')) { | | 402 | + if (($token->type === Token::TYPE_KEYWORD) | | 403 | + && ($token->keyword === 'SELECT')) { | 404 | 404 | /* CREATE TABLE ... SELECT */ | 405 | 405 | $this->select = new SelectStatement($parser, $list); | 406 | | - } elseif (($token->type == Token::TYPE_KEYWORD) && ($token->keyword == 'AS') | 407 | | - && ($list->tokens[$nextidx]->type == Token::TYPE_KEYWORD) | 408 | | - && ($list->tokens[$nextidx]->value == 'SELECT')) { | | 406 | + } elseif (($token->type === Token::TYPE_KEYWORD) && ($token->keyword === 'AS') | | 407 | + && ($list->tokens[$nextidx]->type === Token::TYPE_KEYWORD) | | 408 | + && ($list->tokens[$nextidx]->value === 'SELECT')) { | 409 | 409 | /* CREATE TABLE ... AS SELECT */ | 410 | 410 | $list->idx = $nextidx; | 411 | 411 | $this->select = new SelectStatement($parser, $list); | 412 | | - } elseif ($token->type == Token::TYPE_KEYWORD | 413 | | - && $token->keyword == 'LIKE') { | | 412 | + } elseif ($token->type === Token::TYPE_KEYWORD | | 413 | + && $token->keyword === 'LIKE') { | 414 | 414 | /* CREATE TABLE `new_tbl` LIKE 'orig_tbl' */ | 415 | 415 | $list->idx = $nextidx; | 416 | 416 | $this->like = Expression::parse( | @@ -422,7 +422,7 @@ public function parse(Parser $parser, TokensList $list) | 422 | 422 | ) | 423 | 423 | ); | 424 | 424 | // The 'LIKE' keyword was found, but no table_name was found next to it | 425 | | - if ($this->like == null) { | | 425 | + if (is_null($this->like)) { | 426 | 426 | $parser->error( | 427 | 427 | 'A table name was expected.', | 428 | 428 | $list->tokens[$list->idx] | |
|