@@ -27,11 +27,11 @@ |
||
| 27 | 27 | $debug = empty($argv[3]) ? null : rtrim($argv[3], '/'); |
| 28 | 28 | |
| 29 | 29 | // Checking if all directories are valid. |
| 30 | -if (! is_dir($input)) { |
|
| 30 | +if (!is_dir($input)) { |
|
| 31 | 31 | throw new Exception('The input directory does not exist.'); |
| 32 | -} elseif (! is_dir($output)) { |
|
| 32 | +} elseif (!is_dir($output)) { |
|
| 33 | 33 | throw new Exception('The output directory does not exist.'); |
| 34 | -} elseif (($debug !== null) && (! is_dir($debug))) { |
|
| 34 | +} elseif (($debug !== null) && (!is_dir($debug))) { |
|
| 35 | 35 | throw new Exception('The debug directory does not exist.'); |
| 36 | 36 | } |
| 37 | 37 | |
@@ -26,9 +26,9 @@ |
||
| 26 | 26 | $output = rtrim($argv[2], '/'); |
| 27 | 27 | |
| 28 | 28 | // Checking if all directories are valid. |
| 29 | -if (! is_dir($input)) { |
|
| 29 | +if (!is_dir($input)) { |
|
| 30 | 30 | throw new Exception('The input directory does not exist.'); |
| 31 | -} elseif (! is_dir($output)) { |
|
| 31 | +} elseif (!is_dir($output)) { |
|
| 32 | 32 | throw new Exception('The output directory does not exist.'); |
| 33 | 33 | } |
| 34 | 34 | |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | use function strlen; |
| 21 | 21 | use function substr; |
| 22 | 22 | |
| 23 | -if (! defined('USE_UTF_STRINGS')) { |
|
| 23 | +if (!defined('USE_UTF_STRINGS')) { |
|
| 24 | 24 | // NOTE: In previous versions of PHP (5.5 and older) the default |
| 25 | 25 | // internal encoding is "ISO-8859-1". |
| 26 | 26 | // All `mb_` functions must specify the correct encoding, which is |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | |
| 176 | 176 | // For multi-byte strings, a new instance of `UtfString` is |
| 177 | 177 | // initialized (only if `UtfString` usage is forced. |
| 178 | - if (! $str instanceof UtfString && USE_UTF_STRINGS && $len !== mb_strlen($str, 'UTF-8')) { |
|
| 178 | + if (!$str instanceof UtfString && USE_UTF_STRINGS && $len !== mb_strlen($str, 'UTF-8')) { |
|
| 179 | 179 | $str = new UtfString($str); |
| 180 | 180 | } |
| 181 | 181 | |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | |
| 187 | 187 | // Setting the delimiter. |
| 188 | 188 | $this->setDelimiter( |
| 189 | - ! empty($delimiter) ? $delimiter : static::$DEFAULT_DELIMITER |
|
| 189 | + !empty($delimiter) ? $delimiter : static::$DEFAULT_DELIMITER |
|
| 190 | 190 | ); |
| 191 | 191 | |
| 192 | 192 | $this->lex(); |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | $this->delimiter = null; |
| 321 | 321 | $delimiterLen = 0; |
| 322 | 322 | while (++$this->last < $this->len |
| 323 | - && ! Context::isWhitespace($this->str[$this->last]) |
|
| 323 | + && !Context::isWhitespace($this->str[$this->last]) |
|
| 324 | 324 | && $delimiterLen < 15 |
| 325 | 325 | ) { |
| 326 | 326 | $this->delimiter .= $this->str[$this->last]; |
@@ -566,7 +566,7 @@ discard block |
||
| 566 | 566 | { |
| 567 | 567 | $token = $this->str[$this->last]; |
| 568 | 568 | |
| 569 | - if (! Context::isWhitespace($token)) { |
|
| 569 | + if (!Context::isWhitespace($token)) { |
|
| 570 | 570 | return null; |
| 571 | 571 | } |
| 572 | 572 | |
@@ -613,7 +613,7 @@ discard block |
||
| 613 | 613 | // This can occurs in the following statements: |
| 614 | 614 | // - "SELECT */* comment */ FROM ..." |
| 615 | 615 | // - "SELECT 2*/* comment */3 AS `six`;" |
| 616 | - $next = $this->last+1; |
|
| 616 | + $next = $this->last + 1; |
|
| 617 | 617 | if (($next < $this->len) && $this->str[$next] === '*') { |
| 618 | 618 | // Conflict in "*/*": first "*" was not for ending a comment. |
| 619 | 619 | // Stop here and let other parsing method define the true behavior of that first star. |
@@ -806,7 +806,7 @@ discard block |
||
| 806 | 806 | } |
| 807 | 807 | } elseif ($state === 2) { |
| 808 | 808 | $flags |= Token::FLAG_NUMBER_HEX; |
| 809 | - if (! ( |
|
| 809 | + if (!( |
|
| 810 | 810 | ($this->str[$this->last] >= '0' && $this->str[$this->last] <= '9') |
| 811 | 811 | || ($this->str[$this->last] >= 'A' && $this->str[$this->last] <= 'F') |
| 812 | 812 | || ($this->str[$this->last] >= 'a' && $this->str[$this->last] <= 'f') |
@@ -907,7 +907,7 @@ discard block |
||
| 907 | 907 | $token = $this->str[$this->last]; |
| 908 | 908 | $flags = Context::isString($token); |
| 909 | 909 | |
| 910 | - if (! $flags && $token !== $quote) { |
|
| 910 | + if (!$flags && $token !== $quote) { |
|
| 911 | 911 | return null; |
| 912 | 912 | } |
| 913 | 913 | |
@@ -958,7 +958,7 @@ discard block |
||
| 958 | 958 | $token = $this->str[$this->last]; |
| 959 | 959 | $flags = Context::isSymbol($token); |
| 960 | 960 | |
| 961 | - if (! $flags) { |
|
| 961 | + if (!$flags) { |
|
| 962 | 962 | return null; |
| 963 | 963 | } |
| 964 | 964 | |
@@ -1013,7 +1013,7 @@ discard block |
||
| 1013 | 1013 | return null; |
| 1014 | 1014 | } |
| 1015 | 1015 | |
| 1016 | - while (++$this->last < $this->len && ! Context::isSeparator($this->str[$this->last])) { |
|
| 1016 | + while (++$this->last < $this->len && !Context::isSeparator($this->str[$this->last])) { |
|
| 1017 | 1017 | $token .= $this->str[$this->last]; |
| 1018 | 1018 | |
| 1019 | 1019 | // Test if end of token equals the current delimiter. If so, remove it from the token. |
@@ -26,8 +26,8 @@ discard block |
||
| 26 | 26 | public static function getForeignKeys($statement) |
| 27 | 27 | { |
| 28 | 28 | if (empty($statement->fields) |
| 29 | - || (! is_array($statement->fields)) |
|
| 30 | - || (! $statement->options->has('TABLE')) |
|
| 29 | + || (!is_array($statement->fields)) |
|
| 30 | + || (!$statement->options->has('TABLE')) |
|
| 31 | 31 | ) { |
| 32 | 32 | return []; |
| 33 | 33 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | 'index_list' => $columns, |
| 50 | 50 | ]; |
| 51 | 51 | |
| 52 | - if (! empty($field->references)) { |
|
| 52 | + if (!empty($field->references)) { |
|
| 53 | 53 | $tmp['ref_db_name'] = $field->references->table->database; |
| 54 | 54 | $tmp['ref_table_name'] = $field->references->table->table; |
| 55 | 55 | $tmp['ref_index_list'] = $field->references->columns; |
@@ -83,8 +83,8 @@ discard block |
||
| 83 | 83 | public static function getFields($statement) |
| 84 | 84 | { |
| 85 | 85 | if (empty($statement->fields) |
| 86 | - || (! is_array($statement->fields)) |
|
| 87 | - || (! $statement->options->has('TABLE')) |
|
| 86 | + || (!is_array($statement->fields)) |
|
| 87 | + || (!$statement->options->has('TABLE')) |
|
| 88 | 88 | ) { |
| 89 | 89 | return []; |
| 90 | 90 | } |
@@ -117,7 +117,7 @@ |
||
| 117 | 117 | 'opts' => [], |
| 118 | 118 | ]; |
| 119 | 119 | |
| 120 | - if (! empty($statement->parameters)) { |
|
| 120 | + if (!empty($statement->parameters)) { |
|
| 121 | 121 | $idx = 0; |
| 122 | 122 | foreach ($statement->parameters as $param) { |
| 123 | 123 | $retval['dir'][$idx] = $param->inOut; |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | public static function getAliases($statement, $database) |
| 27 | 27 | { |
| 28 | - if (! ($statement instanceof SelectStatement) |
|
| 28 | + if (!($statement instanceof SelectStatement) |
|
| 29 | 29 | || empty($statement->expr) |
| 30 | 30 | || empty($statement->from) |
| 31 | 31 | ) { |
@@ -45,28 +45,28 @@ discard block |
||
| 45 | 45 | $expressions = $statement->from; |
| 46 | 46 | |
| 47 | 47 | // Adding expressions from JOIN. |
| 48 | - if (! empty($statement->join)) { |
|
| 48 | + if (!empty($statement->join)) { |
|
| 49 | 49 | foreach ($statement->join as $join) { |
| 50 | 50 | $expressions[] = $join->expr; |
| 51 | 51 | } |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | foreach ($expressions as $expr) { |
| 55 | - if (! isset($expr->table) || ($expr->table === '')) { |
|
| 55 | + if (!isset($expr->table) || ($expr->table === '')) { |
|
| 56 | 56 | continue; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | $thisDb = isset($expr->database) && ($expr->database !== '') ? |
| 60 | 60 | $expr->database : $database; |
| 61 | 61 | |
| 62 | - if (! isset($retval[$thisDb])) { |
|
| 62 | + if (!isset($retval[$thisDb])) { |
|
| 63 | 63 | $retval[$thisDb] = [ |
| 64 | 64 | 'alias' => null, |
| 65 | 65 | 'tables' => [], |
| 66 | 66 | ]; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - if (! isset($retval[$thisDb]['tables'][$expr->table])) { |
|
| 69 | + if (!isset($retval[$thisDb]['tables'][$expr->table])) { |
|
| 70 | 70 | $retval[$thisDb]['tables'][$expr->table] = [ |
| 71 | 71 | 'alias' => isset($expr->alias) && ($expr->alias !== '') ? |
| 72 | 72 | $expr->alias : null, |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | ]; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - if (! isset($tables[$thisDb])) { |
|
| 77 | + if (!isset($tables[$thisDb])) { |
|
| 78 | 78 | $tables[$thisDb] = []; |
| 79 | 79 | } |
| 80 | 80 | |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | foreach ($statement->expr as $expr) { |
| 85 | - if (! isset($expr->column, $expr->alias) || ($expr->column === '') || ($expr->alias === '') |
|
| 85 | + if (!isset($expr->column, $expr->alias) || ($expr->column === '') || ($expr->alias === '') |
|
| 86 | 86 | ) { |
| 87 | 87 | continue; |
| 88 | 88 | } |
@@ -265,13 +265,13 @@ discard block |
||
| 265 | 265 | /* Sanitize the array so that we do not have to care later */ |
| 266 | 266 | foreach ($newFormats as $j => $new) { |
| 267 | 267 | foreach ($integers as $name) { |
| 268 | - if (! isset($new[$name])) { |
|
| 268 | + if (!isset($new[$name])) { |
|
| 269 | 269 | $newFormats[$j][$name] = 0; |
| 270 | 270 | } |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | foreach ($strings as $name) { |
| 274 | - if (! isset($new[$name])) { |
|
| 274 | + if (!isset($new[$name])) { |
|
| 275 | 275 | $newFormats[$j][$name] = ''; |
| 276 | 276 | } |
| 277 | 277 | } |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | |
| 292 | 292 | /* Add not already handled formats */ |
| 293 | 293 | foreach ($newFormats as $j => $new) { |
| 294 | - if (! in_array($j, $added)) { |
|
| 294 | + if (!in_array($j, $added)) { |
|
| 295 | 295 | $formats[] = $new; |
| 296 | 296 | } |
| 297 | 297 | } |
@@ -419,7 +419,7 @@ discard block |
||
| 419 | 419 | |
| 420 | 420 | // The options of a clause should stay on the same line and everything that follows. |
| 421 | 421 | if ($this->options['parts_newline'] |
| 422 | - && ! $formattedOptions |
|
| 422 | + && !$formattedOptions |
|
| 423 | 423 | && empty(self::$INLINE_CLAUSES[$lastClause]) |
| 424 | 424 | && ( |
| 425 | 425 | $curr->type !== Token::TYPE_KEYWORD |
@@ -476,7 +476,7 @@ discard block |
||
| 476 | 476 | if (end($blocksLineEndings) === true |
| 477 | 477 | || ( |
| 478 | 478 | empty(self::$INLINE_CLAUSES[$lastClause]) |
| 479 | - && ! $shortGroup |
|
| 479 | + && !$shortGroup |
|
| 480 | 480 | && $this->options['parts_newline'] |
| 481 | 481 | ) |
| 482 | 482 | ) { |
@@ -517,7 +517,7 @@ discard block |
||
| 517 | 517 | // Also, some tokens do not have spaces before or after them. |
| 518 | 518 | if (// A space after delimiters that are longer than 2 characters. |
| 519 | 519 | $prev->keyword === 'DELIMITER' |
| 520 | - || ! ( |
|
| 520 | + || !( |
|
| 521 | 521 | ($prev->type === Token::TYPE_OPERATOR && ($prev->value === '.' || $prev->value === '(')) |
| 522 | 522 | // No space after . ( |
| 523 | 523 | || ($curr->type === Token::TYPE_OPERATOR |
@@ -635,7 +635,7 @@ discard block |
||
| 635 | 635 | && ($token->flags & $format['flags']) === $format['flags'] |
| 636 | 636 | ) { |
| 637 | 637 | // Running transformation function. |
| 638 | - if (! empty($format['function'])) { |
|
| 638 | + if (!empty($format['function'])) { |
|
| 639 | 639 | $func = $format['function']; |
| 640 | 640 | $text = $func($text); |
| 641 | 641 | } |
@@ -63,11 +63,11 @@ discard block |
||
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | $this->mergeLongOpts($params, $longopts); |
| 66 | - if (! isset($params['f'])) { |
|
| 66 | + if (!isset($params['f'])) { |
|
| 67 | 67 | $params['f'] = 'cli'; |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - if (! in_array($params['f'], ['html', 'cli', 'text'])) { |
|
| 70 | + if (!in_array($params['f'], ['html', 'cli', 'text'])) { |
|
| 71 | 71 | echo "ERROR: Invalid value for format!\n"; |
| 72 | 72 | |
| 73 | 73 | return false; |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | return 0; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - if (! isset($params['q'])) { |
|
| 92 | + if (!isset($params['q'])) { |
|
| 93 | 93 | $stdIn = $this->readStdin(); |
| 94 | 94 | |
| 95 | 95 | if ($stdIn) { |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | Context::load($params['c']); |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | - if (! isset($params['q'])) { |
|
| 159 | + if (!isset($params['q'])) { |
|
| 160 | 160 | $stdIn = $this->readStdin(); |
| 161 | 161 | |
| 162 | 162 | if ($stdIn) { |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | return 0; |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | - if (! isset($params['q'])) { |
|
| 226 | + if (!isset($params['q'])) { |
|
| 227 | 227 | $stdIn = $this->readStdin(); |
| 228 | 228 | |
| 229 | 229 | if ($stdIn) { |
@@ -56,8 +56,8 @@ discard block |
||
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | // Flags. |
| 59 | - return ! isset($pattern['flags']) |
|
| 60 | - || (! (($pattern['flags'] & $token->flags) === 0)); |
|
| 59 | + return !isset($pattern['flags']) |
|
| 60 | + || (!(($pattern['flags'] & $token->flags) === 0)); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | public static function replaceTokens($list, array $find, array $replace) |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | $isList = $list instanceof TokensList; |
| 71 | 71 | |
| 72 | 72 | // Parsing the tokens. |
| 73 | - if (! $isList) { |
|
| 73 | + if (!$isList) { |
|
| 74 | 74 | $list = Lexer::getTokens($list); |
| 75 | 75 | } |
| 76 | 76 | |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | ++$j; |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - if (! static::match($list->tokens[$j], $find[$k])) { |
|
| 133 | + if (!static::match($list->tokens[$j], $find[$k])) { |
|
| 134 | 134 | // This token does not match the pattern. |
| 135 | 135 | break; |
| 136 | 136 | } |