@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | |
| 314 | 314 | // Parsing the delimiter. |
| 315 | 315 | $delimiter = ''; |
| 316 | - while (($i < $len) && (! Context::isWhitespace($this->query[$i]))) { |
|
| 316 | + while (($i < $len) && (!Context::isWhitespace($this->query[$i]))) { |
|
| 317 | 317 | $delimiter .= $this->query[$i++]; |
| 318 | 318 | } |
| 319 | 319 | |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | |
| 328 | 328 | // Whether this statement should be returned or not. |
| 329 | 329 | $ret = ''; |
| 330 | - if (! empty($this->options['parse_delimiter'])) { |
|
| 330 | + if (!empty($this->options['parse_delimiter'])) { |
|
| 331 | 331 | // Appending the `DELIMITER` statement that was just |
| 332 | 332 | // found to the current statement. |
| 333 | 333 | $ret = trim( |
@@ -369,7 +369,7 @@ discard block |
||
| 369 | 369 | $ret = $this->current; |
| 370 | 370 | |
| 371 | 371 | // If needed, adds a delimiter at the end of the statement. |
| 372 | - if (! empty($this->options['add_delimiter'])) { |
|
| 372 | + if (!empty($this->options['add_delimiter'])) { |
|
| 373 | 373 | $ret .= $this->delimiter; |
| 374 | 374 | } |
| 375 | 375 | |
@@ -44,7 +44,7 @@ |
||
| 44 | 44 | */ |
| 45 | 45 | public function __construct(array $tokens = array(), $count = -1) |
| 46 | 46 | { |
| 47 | - if (! empty($tokens)) { |
|
| 47 | + if (!empty($tokens)) { |
|
| 48 | 48 | $this->tokens = $tokens; |
| 49 | 49 | if ($count === -1) { |
| 50 | 50 | $this->count = count($tokens); |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | |
| 169 | 169 | // Checking if this field was already built. |
| 170 | 170 | if ($type & 1) { |
| 171 | - if (! empty($built[$field])) { |
|
| 171 | + if (!empty($built[$field])) { |
|
| 172 | 172 | continue; |
| 173 | 173 | } |
| 174 | 174 | $built[$field] = true; |
@@ -306,10 +306,10 @@ discard block |
||
| 306 | 306 | $options = array(); |
| 307 | 307 | |
| 308 | 308 | // Looking for duplicated clauses. |
| 309 | - if (! empty(Parser::$KEYWORD_PARSERS[$token->value]) |
|
| 310 | - || ! empty(Parser::$STATEMENT_PARSERS[$token->value]) |
|
| 309 | + if (!empty(Parser::$KEYWORD_PARSERS[$token->value]) |
|
| 310 | + || !empty(Parser::$STATEMENT_PARSERS[$token->value]) |
|
| 311 | 311 | ) { |
| 312 | - if (! empty($parsedClauses[$token->value])) { |
|
| 312 | + if (!empty($parsedClauses[$token->value])) { |
|
| 313 | 313 | $parser->error( |
| 314 | 314 | 'This type of clause was previously parsed.', |
| 315 | 315 | $token |
@@ -324,17 +324,17 @@ discard block |
||
| 324 | 324 | // but it might be the beginning of a statement of truncate, |
| 325 | 325 | // so let the value use the keyword field for truncate type. |
| 326 | 326 | $token_value = in_array($token->keyword, array('TRUNCATE')) ? $token->keyword : $token->value; |
| 327 | - if (! empty(Parser::$KEYWORD_PARSERS[$token_value]) && $list->idx < $list->count) { |
|
| 327 | + if (!empty(Parser::$KEYWORD_PARSERS[$token_value]) && $list->idx < $list->count) { |
|
| 328 | 328 | $class = Parser::$KEYWORD_PARSERS[$token_value]['class']; |
| 329 | 329 | $field = Parser::$KEYWORD_PARSERS[$token_value]['field']; |
| 330 | - if (! empty(Parser::$KEYWORD_PARSERS[$token_value]['options'])) { |
|
| 330 | + if (!empty(Parser::$KEYWORD_PARSERS[$token_value]['options'])) { |
|
| 331 | 331 | $options = Parser::$KEYWORD_PARSERS[$token_value]['options']; |
| 332 | 332 | } |
| 333 | 333 | } |
| 334 | 334 | |
| 335 | 335 | // Checking if this is the beginning of the statement. |
| 336 | - if (! empty(Parser::$STATEMENT_PARSERS[$token->keyword])) { |
|
| 337 | - if (! empty(static::$CLAUSES) // Undefined for some statements. |
|
| 336 | + if (!empty(Parser::$STATEMENT_PARSERS[$token->keyword])) { |
|
| 337 | + if (!empty(static::$CLAUSES) // Undefined for some statements. |
|
| 338 | 338 | && empty(static::$CLAUSES[$token->value]) |
| 339 | 339 | ) { |
| 340 | 340 | // Some keywords (e.g. `SET`) may be the beginning of a |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | ); |
| 349 | 349 | break; |
| 350 | 350 | } |
| 351 | - if (! $parsedOptions) { |
|
| 351 | + if (!$parsedOptions) { |
|
| 352 | 352 | if (empty(static::$OPTIONS[$token->value])) { |
| 353 | 353 | // Skipping keyword because if it is not a option. |
| 354 | 354 | ++$list->idx; |
@@ -528,7 +528,7 @@ discard block |
||
| 528 | 528 | if ($minJoin === 0 && stripos($clauseType, 'JOIN')) { |
| 529 | 529 | // First JOIN clause is detected |
| 530 | 530 | $minJoin = $maxJoin = $clauseStartIdx; |
| 531 | - } elseif ($minJoin !== 0 && ! stripos($clauseType, 'JOIN')) { |
|
| 531 | + } elseif ($minJoin !== 0 && !stripos($clauseType, 'JOIN')) { |
|
| 532 | 532 | // After a previous JOIN clause, a non-JOIN clause has been detected |
| 533 | 533 | $maxJoin = $lastIdx; |
| 534 | 534 | } elseif ($maxJoin < $clauseStartIdx && stripos($clauseType, 'JOIN')) { |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | */ |
| 59 | 59 | public static function gettext($msgid) |
| 60 | 60 | { |
| 61 | - if (! class_exists('\PhpMyAdmin\MoTranslator\Loader', true)) { |
|
| 61 | + if (!class_exists('\PhpMyAdmin\MoTranslator\Loader', true)) { |
|
| 62 | 62 | return $msgid; |
| 63 | 63 | } |
| 64 | 64 | |
@@ -470,7 +470,7 @@ discard block |
||
| 470 | 470 | |
| 471 | 471 | // Checking if it is a known statement that can be parsed. |
| 472 | 472 | if (empty(static::$STATEMENT_PARSERS[$token->keyword])) { |
| 473 | - if (! isset(static::$STATEMENT_PARSERS[$token->keyword])) { |
|
| 473 | + if (!isset(static::$STATEMENT_PARSERS[$token->keyword])) { |
|
| 474 | 474 | // A statement is considered recognized if the parser |
| 475 | 475 | // is aware that it is a statement, but it does not have |
| 476 | 476 | // a parser for it yet. |
@@ -511,7 +511,7 @@ discard block |
||
| 511 | 511 | $prevLastIdx = $list->idx; |
| 512 | 512 | |
| 513 | 513 | // Handles unions. |
| 514 | - if (! empty($unionType) |
|
| 514 | + if (!empty($unionType) |
|
| 515 | 515 | && ($lastStatement instanceof SelectStatement) |
| 516 | 516 | && ($statement instanceof SelectStatement) |
| 517 | 517 | ) { |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | $str = strtoupper($str); |
| 276 | 276 | |
| 277 | 277 | if (isset(static::$KEYWORDS[$str])) { |
| 278 | - if ($isReserved && ! (static::$KEYWORDS[$str] & Token::FLAG_KEYWORD_RESERVED)) { |
|
| 278 | + if ($isReserved && !(static::$KEYWORDS[$str] & Token::FLAG_KEYWORD_RESERVED)) { |
|
| 279 | 279 | return null; |
| 280 | 280 | } |
| 281 | 281 | |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | */ |
| 298 | 298 | public static function isOperator($str) |
| 299 | 299 | { |
| 300 | - if (! isset(static::$OPERATORS[$str])) { |
|
| 300 | + if (!isset(static::$OPERATORS[$str])) { |
|
| 301 | 301 | return null; |
| 302 | 302 | } |
| 303 | 303 | |
@@ -489,7 +489,7 @@ discard block |
||
| 489 | 489 | // Short context name (must be formatted into class name). |
| 490 | 490 | $context = self::$contextPrefix . $context; |
| 491 | 491 | } |
| 492 | - if (! class_exists($context)) { |
|
| 492 | + if (!class_exists($context)) { |
|
| 493 | 493 | throw @new LoaderException( |
| 494 | 494 | 'Specified context ("' . $context . '") does not exist.', |
| 495 | 495 | $context |
@@ -526,7 +526,7 @@ discard block |
||
| 526 | 526 | $i -= 2; |
| 527 | 527 | $part = substr($context, $i, 2); |
| 528 | 528 | /* No more numeric parts to strip */ |
| 529 | - if (! is_numeric($part)) { |
|
| 529 | + if (!is_numeric($part)) { |
|
| 530 | 530 | break 2; |
| 531 | 531 | } |
| 532 | 532 | } while (intval($part) === 0 && $i > 0); |
@@ -578,7 +578,7 @@ discard block |
||
| 578 | 578 | } |
| 579 | 579 | |
| 580 | 580 | if ((static::$MODE & self::SQL_MODE_NO_ENCLOSING_QUOTES) |
| 581 | - && (! static::isKeyword($str, true)) |
|
| 581 | + && (!static::isKeyword($str, true)) |
|
| 582 | 582 | ) { |
| 583 | 583 | return $str; |
| 584 | 584 | } |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | $value = strtoupper($value); |
| 158 | - if (! isset($types[$value])) { |
|
| 158 | + if (!isset($types[$value])) { |
|
| 159 | 159 | $types[$value] = $type; |
| 160 | 160 | } else { |
| 161 | 161 | $types[$value] |= $type; |
@@ -165,10 +165,10 @@ discard block |
||
| 165 | 165 | $ret = array(); |
| 166 | 166 | foreach ($types as $word => $type) { |
| 167 | 167 | $len = strlen($word); |
| 168 | - if (! isset($ret[$type])) { |
|
| 168 | + if (!isset($ret[$type])) { |
|
| 169 | 169 | $ret[$type] = array(); |
| 170 | 170 | } |
| 171 | - if (! isset($ret[$type][$len])) { |
|
| 171 | + if (!isset($ret[$type][$len])) { |
|
| 172 | 172 | $ret[$type][$len] = array(); |
| 173 | 173 | } |
| 174 | 174 | $ret[$type][$len][] = $word; |
@@ -389,9 +389,9 @@ discard block |
||
| 389 | 389 | $output = rtrim($argv[2], '/'); |
| 390 | 390 | |
| 391 | 391 | // Checking if all directories are valid. |
| 392 | - if (! is_dir($input)) { |
|
| 392 | + if (!is_dir($input)) { |
|
| 393 | 393 | throw new \Exception('The input directory does not exist.'); |
| 394 | - } elseif (! is_dir($output)) { |
|
| 394 | + } elseif (!is_dir($output)) { |
|
| 395 | 395 | throw new \Exception('The output directory does not exist.'); |
| 396 | 396 | } |
| 397 | 397 | |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | } elseif (($token->type === Token::TYPE_OPERATOR) |
| 94 | 94 | && ($token->value === ',') |
| 95 | 95 | ) { |
| 96 | - if (! empty($expr->expr)) { |
|
| 96 | + if (!empty($expr->expr)) { |
|
| 97 | 97 | $ret[] = $expr; |
| 98 | 98 | } |
| 99 | 99 | $expr = new self(); |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | // Last iteration was not processed. |
| 108 | - if (! empty($expr->expr)) { |
|
| 108 | + if (!empty($expr->expr)) { |
|
| 109 | 109 | $ret[] = $expr; |
| 110 | 110 | } |
| 111 | 111 | |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | // The code below extracts only the relevant information. |
| 62 | 62 | |
| 63 | 63 | // Extracting lexer's errors. |
| 64 | - if (! empty($lexer->errors)) { |
|
| 64 | + if (!empty($lexer->errors)) { |
|
| 65 | 65 | foreach ($lexer->errors as $err) { |
| 66 | 66 | $lexerErrors[] = array( |
| 67 | 67 | $err->getMessage(), |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | // Extracting parser's errors. |
| 77 | - if (! empty($parser->errors)) { |
|
| 77 | + if (!empty($parser->errors)) { |
|
| 78 | 78 | foreach ($parser->errors as $err) { |
| 79 | 79 | $parserErrors[] = array( |
| 80 | 80 | $err->getMessage(), |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | public static function build($type, $input, $output, $debug = null, $ansi = false) |
| 111 | 111 | { |
| 112 | 112 | // Support query types: `lexer` / `parser`. |
| 113 | - if (! in_array($type, array('lexer', 'parser'))) { |
|
| 113 | + if (!in_array($type, array('lexer', 'parser'))) { |
|
| 114 | 114 | throw new \Exception('Unknown test type (expected `lexer` or `parser`).'); |
| 115 | 115 | } |
| 116 | 116 | |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | file_put_contents($output, serialize($test)); |
| 141 | 141 | |
| 142 | 142 | // Dumping test's data in human readable format too (if required). |
| 143 | - if (! empty($debug)) { |
|
| 143 | + if (!empty($debug)) { |
|
| 144 | 144 | file_put_contents($debug, print_r($test, true)); |
| 145 | 145 | } |
| 146 | 146 | } |
@@ -170,10 +170,10 @@ discard block |
||
| 170 | 170 | if (is_dir($inputFile)) { |
| 171 | 171 | // Creating required directories to maintain the structure. |
| 172 | 172 | // Ignoring errors if the folder structure exists already. |
| 173 | - if (! is_dir($outputFile)) { |
|
| 173 | + if (!is_dir($outputFile)) { |
|
| 174 | 174 | mkdir($outputFile); |
| 175 | 175 | } |
| 176 | - if (($debug !== null) && (! is_dir($debugFile))) { |
|
| 176 | + if (($debug !== null) && (!is_dir($debugFile))) { |
|
| 177 | 177 | mkdir($debugFile); |
| 178 | 178 | } |
| 179 | 179 | |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | // Building the test. |
| 191 | - if (! file_exists($outputFile)) { |
|
| 191 | + if (!file_exists($outputFile)) { |
|
| 192 | 192 | sprintf("Building test for %s...\n", $inputFile); |
| 193 | 193 | static::build( |
| 194 | 194 | strpos($inputFile, 'lex') !== false ? 'lexer' : 'parser', |
@@ -222,11 +222,11 @@ discard block |
||
| 222 | 222 | $debug = empty($argv[3]) ? null : rtrim($argv[3], '/'); |
| 223 | 223 | |
| 224 | 224 | // Checking if all directories are valid. |
| 225 | - if (! is_dir($input)) { |
|
| 225 | + if (!is_dir($input)) { |
|
| 226 | 226 | throw new \Exception('The input directory does not exist.'); |
| 227 | - } elseif (! is_dir($output)) { |
|
| 227 | + } elseif (!is_dir($output)) { |
|
| 228 | 228 | throw new \Exception('The output directory does not exist.'); |
| 229 | - } elseif (($debug !== null) && (! is_dir($debug))) { |
|
| 229 | + } elseif (($debug !== null) && (!is_dir($debug))) { |
|
| 230 | 230 | throw new \Exception('The debug directory does not exist.'); |
| 231 | 231 | } |
| 232 | 232 | |