Completed
Pull Request — master (#107)
by Deven
675:41 queued 610:42
created
src/Statements/DeleteStatement.php 2 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -302,7 +302,7 @@
 block discarded – undo
302 302
                     ++$list->idx; // Skip 'ORDER  BY'
303 303
                     $this->order = OrderKeyword::parse($parser, $list);
304 304
                     $state = 5;
305
-                }  elseif ($token->type === Token::TYPE_KEYWORD
305
+                } elseif ($token->type === Token::TYPE_KEYWORD
306 306
                     && $token->value === 'LIMIT'
307 307
                 ) {
308 308
                     ++$list->idx; // Skip 'LIMIT'
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -71,15 +71,15 @@
 block discarded – undo
71 71
      * @var array
72 72
      */
73 73
     public static $CLAUSES = array(
74
-        'DELETE'                        => array('DELETE',      2),
74
+        'DELETE'                        => array('DELETE', 2),
75 75
         // Used for options.
76
-        '_OPTIONS'                      => array('_OPTIONS',    1),
77
-        'FROM'                          => array('FROM',        3),
78
-        'PARTITION'                     => array('PARTITION',   3),
79
-        'USING'                         => array('USING',       3),
80
-        'WHERE'                         => array('WHERE',       3),
81
-        'ORDER BY'                      => array('ORDER BY',    3),
82
-        'LIMIT'                         => array('LIMIT',       3),
76
+        '_OPTIONS'                      => array('_OPTIONS', 1),
77
+        'FROM'                          => array('FROM', 3),
78
+        'PARTITION'                     => array('PARTITION', 3),
79
+        'USING'                         => array('USING', 3),
80
+        'WHERE'                         => array('WHERE', 3),
81
+        'ORDER BY'                      => array('ORDER BY', 3),
82
+        'LIMIT'                         => array('LIMIT', 3),
83 83
     );
84 84
 
85 85
     /**
Please login to merge, or discard this patch.
src/Components/CaseExpression.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@
 block discarded – undo
77 77
      * @param Parser     $parser  The parser that serves as context.
78 78
      * @param TokensList $list    The list of tokens that are being parsed.
79 79
      *
80
-     * @return Expression
80
+     * @return CaseExpression
81 81
      */
82 82
     public static function parse(Parser $parser, TokensList $list)
83 83
     {
Please login to merge, or discard this patch.
src/Statements/SelectStatement.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -87,36 +87,36 @@
 block discarded – undo
87 87
      * @var array
88 88
      */
89 89
     public static $CLAUSES = array(
90
-        'SELECT'                        => array('SELECT',                  2),
90
+        'SELECT'                        => array('SELECT', 2),
91 91
         // Used for options.
92
-        '_OPTIONS'                      => array('_OPTIONS',                1),
92
+        '_OPTIONS'                      => array('_OPTIONS', 1),
93 93
         // Used for selected expressions.
94
-        '_SELECT'                       => array('SELECT',                  1),
95
-        'INTO'                          => array('INTO',                    3),
96
-        'FROM'                          => array('FROM',                    3),
97
-        'PARTITION'                     => array('PARTITION',               3),
98
-
99
-        'JOIN'                          => array('JOIN',                    1),
100
-        'FULL JOIN'                     => array('FULL JOIN',               1),
101
-        'INNER JOIN'                    => array('INNER JOIN',              1),
102
-        'LEFT JOIN'                     => array('LEFT JOIN',               1),
103
-        'LEFT OUTER JOIN'               => array('LEFT OUTER JOIN',         1),
104
-        'RIGHT JOIN'                    => array('RIGHT JOIN',              1),
105
-        'RIGHT OUTER JOIN'              => array('RIGHT OUTER JOIN',        1),
106
-        'NATURAL JOIN'                  => array('NATURAL JOIN',            1),
107
-        'NATURAL LEFT JOIN'             => array('NATURAL LEFT JOIN',       1),
108
-        'NATURAL RIGHT JOIN'            => array('NATURAL RIGHT JOIN',      1),
94
+        '_SELECT'                       => array('SELECT', 1),
95
+        'INTO'                          => array('INTO', 3),
96
+        'FROM'                          => array('FROM', 3),
97
+        'PARTITION'                     => array('PARTITION', 3),
98
+
99
+        'JOIN'                          => array('JOIN', 1),
100
+        'FULL JOIN'                     => array('FULL JOIN', 1),
101
+        'INNER JOIN'                    => array('INNER JOIN', 1),
102
+        'LEFT JOIN'                     => array('LEFT JOIN', 1),
103
+        'LEFT OUTER JOIN'               => array('LEFT OUTER JOIN', 1),
104
+        'RIGHT JOIN'                    => array('RIGHT JOIN', 1),
105
+        'RIGHT OUTER JOIN'              => array('RIGHT OUTER JOIN', 1),
106
+        'NATURAL JOIN'                  => array('NATURAL JOIN', 1),
107
+        'NATURAL LEFT JOIN'             => array('NATURAL LEFT JOIN', 1),
108
+        'NATURAL RIGHT JOIN'            => array('NATURAL RIGHT JOIN', 1),
109 109
         'NATURAL LEFT OUTER JOIN'       => array('NATURAL LEFT OUTER JOIN', 1),
110
-        'NATURAL RIGHT OUTER JOIN'      => array('NATURAL RIGHT JOIN',      1),
111
-
112
-        'WHERE'                         => array('WHERE',                   3),
113
-        'GROUP BY'                      => array('GROUP BY',                3),
114
-        'HAVING'                        => array('HAVING',                  3),
115
-        'ORDER BY'                      => array('ORDER BY',                3),
116
-        'LIMIT'                         => array('LIMIT',                   3),
117
-        'PROCEDURE'                     => array('PROCEDURE',               3),
118
-        'UNION'                         => array('UNION',                   1),
119
-        '_END_OPTIONS'                  => array('_END_OPTIONS',            1)
110
+        'NATURAL RIGHT OUTER JOIN'      => array('NATURAL RIGHT JOIN', 1),
111
+
112
+        'WHERE'                         => array('WHERE', 3),
113
+        'GROUP BY'                      => array('GROUP BY', 3),
114
+        'HAVING'                        => array('HAVING', 3),
115
+        'ORDER BY'                      => array('ORDER BY', 3),
116
+        'LIMIT'                         => array('LIMIT', 3),
117
+        'PROCEDURE'                     => array('PROCEDURE', 3),
118
+        'UNION'                         => array('UNION', 1),
119
+        '_END_OPTIONS'                  => array('_END_OPTIONS', 1)
120 120
         // These are available only when `UNION` is present.
121 121
         // 'ORDER BY'                      => array('ORDER BY',    3),
122 122
         // 'LIMIT'                         => array('LIMIT',       3),
Please login to merge, or discard this patch.
tools/ContextGenerator.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -52,46 +52,46 @@  discard block
 block discarded – undo
52 52
      * @var string
53 53
      */
54 54
     const TEMPLATE =
55
-        '<?php'                                                                             . "\n" .
56
-        ''                                                                                  . "\n" .
57
-        '/**'                                                                               . "\n" .
58
-        ' * Context for %1$s.'                                                              . "\n" .
59
-        ' *'                                                                                . "\n" .
60
-        ' * This file was auto-generated.'                                                  . "\n" .
61
-        ' *'                                                                                . "\n" .
62
-        ' * @package    SqlParser'                                                          . "\n" .
63
-        ' * @subpackage Contexts'                                                           . "\n" .
64
-        ' * @link       %3$s'                                                               . "\n" .
65
-        ' */'                                                                               . "\n" .
66
-        'namespace SqlParser\\Contexts;'                                                    . "\n" .
67
-        ''                                                                                  . "\n" .
68
-        'use SqlParser\\Context;'                                                           . "\n" .
69
-        ''                                                                                  . "\n" .
70
-        '/**'                                                                               . "\n" .
71
-        ' * Context for %1$s.'                                                              . "\n" .
72
-        ' *'                                                                                . "\n" .
73
-        ' * @category   Contexts'                                                           . "\n" .
74
-        ' * @package    SqlParser'                                                          . "\n" .
75
-        ' * @subpackage Contexts'                                                           . "\n" .
76
-        ' * @license    https://www.gnu.org/licenses/gpl-2.0.txt GPL-2.0+'                  . "\n" .
77
-        ' */'                                                                               . "\n" .
78
-        'class %2$s extends Context'                                                        . "\n" .
79
-        '{'                                                                                 . "\n" .
80
-        ''                                                                                  . "\n" .
81
-        '    /**'                                                                           . "\n" .
82
-        '     * List of keywords.'                                                          . "\n" .
83
-        '     *'                                                                            . "\n" .
84
-        '     * The value associated to each keyword represents its flags.'                 . "\n" .
85
-        '     *'                                                                            . "\n" .
86
-        '     * @see Token::FLAG_KEYWORD_*'                                                 . "\n" .
87
-        '     *'                                                                            . "\n" .
88
-        '     * @var array'                                                                 . "\n" .
89
-        '     */'                                                                           . "\n" .
90
-        '    public static $KEYWORDS = array('                                              . "\n" .
91
-        ''                                                                                  . "\n" .
92
-        '%4$s'                                                                              .
93
-        '    );'                                                                            . "\n" .
94
-        '}'                                                                                 . "\n";
55
+        '<?php' . "\n" .
56
+        '' . "\n" .
57
+        '/**' . "\n" .
58
+        ' * Context for %1$s.' . "\n" .
59
+        ' *' . "\n" .
60
+        ' * This file was auto-generated.' . "\n" .
61
+        ' *' . "\n" .
62
+        ' * @package    SqlParser' . "\n" .
63
+        ' * @subpackage Contexts' . "\n" .
64
+        ' * @link       %3$s' . "\n" .
65
+        ' */' . "\n" .
66
+        'namespace SqlParser\\Contexts;' . "\n" .
67
+        '' . "\n" .
68
+        'use SqlParser\\Context;' . "\n" .
69
+        '' . "\n" .
70
+        '/**' . "\n" .
71
+        ' * Context for %1$s.' . "\n" .
72
+        ' *' . "\n" .
73
+        ' * @category   Contexts' . "\n" .
74
+        ' * @package    SqlParser' . "\n" .
75
+        ' * @subpackage Contexts' . "\n" .
76
+        ' * @license    https://www.gnu.org/licenses/gpl-2.0.txt GPL-2.0+' . "\n" .
77
+        ' */' . "\n" .
78
+        'class %2$s extends Context' . "\n" .
79
+        '{' . "\n" .
80
+        '' . "\n" .
81
+        '    /**' . "\n" .
82
+        '     * List of keywords.' . "\n" .
83
+        '     *' . "\n" .
84
+        '     * The value associated to each keyword represents its flags.' . "\n" .
85
+        '     *' . "\n" .
86
+        '     * @see Token::FLAG_KEYWORD_*' . "\n" .
87
+        '     *' . "\n" .
88
+        '     * @var array' . "\n" .
89
+        '     */' . "\n" .
90
+        '    public static $KEYWORDS = array(' . "\n" .
91
+        '' . "\n" .
92
+        '%4$s' .
93
+        '    );' . "\n" .
94
+        '}' . "\n";
95 95
 
96 96
     /**
97 97
      * Sorts an array of words.
@@ -286,8 +286,8 @@  discard block
 block discarded – undo
286 286
          * @var string
287 287
          */
288 288
         $formattedName = str_replace(
289
-            array('Context', 'MySql',  '00', '0'),
290
-            array('',        'MySQL ', '',   '.'),
289
+            array('Context', 'MySql', '00', '0'),
290
+            array('', 'MySQL ', '', '.'),
291 291
             $class
292 292
         );
293 293
 
Please login to merge, or discard this patch.
src/Token.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -29,14 +29,14 @@  discard block
 block discarded – undo
29 29
      *
30 30
      * @var int
31 31
      */
32
-    const TYPE_NONE                     =  0;
32
+    const TYPE_NONE = 0;
33 33
 
34 34
     /**
35 35
      * SQL specific keywords: SELECT, UPDATE, INSERT, etc.
36 36
      *
37 37
      * @var int
38 38
      */
39
-    const TYPE_KEYWORD                  =  1;
39
+    const TYPE_KEYWORD = 1;
40 40
 
41 41
     /**
42 42
      * Any type of legal operator.
@@ -50,14 +50,14 @@  discard block
 block discarded – undo
50 50
      *
51 51
      * @var int
52 52
      */
53
-    const TYPE_OPERATOR                 =  2;
53
+    const TYPE_OPERATOR = 2;
54 54
 
55 55
     /**
56 56
      * Spaces, tabs, new lines, etc.
57 57
      *
58 58
      * @var int
59 59
      */
60
-    const TYPE_WHITESPACE               =  3;
60
+    const TYPE_WHITESPACE = 3;
61 61
 
62 62
     /**
63 63
      * Any type of legal comment.
@@ -79,21 +79,21 @@  discard block
 block discarded – undo
79 79
      *
80 80
      * @var int
81 81
      */
82
-    const TYPE_COMMENT                  =  4;
82
+    const TYPE_COMMENT = 4;
83 83
 
84 84
     /**
85 85
      * Boolean values: true or false.
86 86
      *
87 87
      * @var int
88 88
      */
89
-    const TYPE_BOOL                     =  5;
89
+    const TYPE_BOOL = 5;
90 90
 
91 91
     /**
92 92
      * Numbers: 4, 0x8, 15.16, 23e42, etc.
93 93
      *
94 94
      * @var int
95 95
      */
96
-    const TYPE_NUMBER                   =  6;
96
+    const TYPE_NUMBER = 6;
97 97
 
98 98
     /**
99 99
      * Literal strings: 'string', "test".
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
      *
102 102
      * @var int
103 103
      */
104
-    const TYPE_STRING                   =  7;
104
+    const TYPE_STRING = 7;
105 105
 
106 106
     /**
107 107
      * Database, table names, variables, etc.
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      *
110 110
      * @var int
111 111
      */
112
-    const TYPE_SYMBOL                   =  8;
112
+    const TYPE_SYMBOL = 8;
113 113
 
114 114
     /**
115 115
      * Delimits an unknown string.
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
      *
118 118
      * @var int
119 119
      */
120
-    const TYPE_DELIMITER                =  9;
120
+    const TYPE_DELIMITER = 9;
121 121
 
122 122
     /**
123 123
      * Labels in LOOP statement, ITERATE statement etc.
@@ -129,46 +129,46 @@  discard block
 block discarded – undo
129 129
      *
130 130
      * @var int
131 131
      */
132
-    const TYPE_LABEL                =  10;
132
+    const TYPE_LABEL = 10;
133 133
 
134 134
     // Flags that describe the tokens in more detail.
135 135
     // All keywords must have flag 1 so `Context::isKeyword` method doesn't
136 136
     // require strict comparison.
137
-    const FLAG_KEYWORD_RESERVED         =  2;
138
-    const FLAG_KEYWORD_COMPOSED         =  4;
139
-    const FLAG_KEYWORD_DATA_TYPE        =  8;
137
+    const FLAG_KEYWORD_RESERVED         = 2;
138
+    const FLAG_KEYWORD_COMPOSED         = 4;
139
+    const FLAG_KEYWORD_DATA_TYPE        = 8;
140 140
     const FLAG_KEYWORD_KEY              = 16;
141 141
     const FLAG_KEYWORD_FUNCTION         = 32;
142 142
 
143 143
     // Numbers related flags.
144
-    const FLAG_NUMBER_HEX               =  1;
145
-    const FLAG_NUMBER_FLOAT             =  2;
146
-    const FLAG_NUMBER_APPROXIMATE       =  4;
147
-    const FLAG_NUMBER_NEGATIVE          =  8;
144
+    const FLAG_NUMBER_HEX               = 1;
145
+    const FLAG_NUMBER_FLOAT             = 2;
146
+    const FLAG_NUMBER_APPROXIMATE       = 4;
147
+    const FLAG_NUMBER_NEGATIVE          = 8;
148 148
     const FLAG_NUMBER_BINARY            = 16;
149 149
 
150 150
     // Strings related flags.
151
-    const FLAG_STRING_SINGLE_QUOTES     =  1;
152
-    const FLAG_STRING_DOUBLE_QUOTES     =  2;
151
+    const FLAG_STRING_SINGLE_QUOTES     = 1;
152
+    const FLAG_STRING_DOUBLE_QUOTES     = 2;
153 153
 
154 154
     // Comments related flags.
155
-    const FLAG_COMMENT_BASH             =  1;
156
-    const FLAG_COMMENT_C                =  2;
157
-    const FLAG_COMMENT_SQL              =  4;
158
-    const FLAG_COMMENT_MYSQL_CMD        =  8;
155
+    const FLAG_COMMENT_BASH             = 1;
156
+    const FLAG_COMMENT_C                = 2;
157
+    const FLAG_COMMENT_SQL              = 4;
158
+    const FLAG_COMMENT_MYSQL_CMD        = 8;
159 159
 
160 160
     // Operators related flags.
161
-    const FLAG_OPERATOR_ARITHMETIC      =  1;
162
-    const FLAG_OPERATOR_LOGICAL         =  2;
163
-    const FLAG_OPERATOR_BITWISE         =  4;
164
-    const FLAG_OPERATOR_ASSIGNMENT      =  8;
161
+    const FLAG_OPERATOR_ARITHMETIC      = 1;
162
+    const FLAG_OPERATOR_LOGICAL         = 2;
163
+    const FLAG_OPERATOR_BITWISE         = 4;
164
+    const FLAG_OPERATOR_ASSIGNMENT      = 8;
165 165
     const FLAG_OPERATOR_SQL             = 16;
166 166
 
167 167
     // Symbols related flags.
168
-    const FLAG_SYMBOL_VARIABLE          =  1;
169
-    const FLAG_SYMBOL_BACKTICK          =  2;
170
-    const FLAG_SYMBOL_USER              =  4;
171
-    const FLAG_SYMBOL_SYSTEM            =  8;
168
+    const FLAG_SYMBOL_VARIABLE          = 1;
169
+    const FLAG_SYMBOL_BACKTICK          = 2;
170
+    const FLAG_SYMBOL_USER              = 4;
171
+    const FLAG_SYMBOL_SYSTEM            = 8;
172 172
 
173 173
     /**
174 174
      * The token it its raw string representation.
Please login to merge, or discard this patch.
src/Components/Expression.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
                     $ret->subquery = $token->value;
228 228
                 } elseif (($token->flags & Token::FLAG_KEYWORD_FUNCTION)
229 229
                     && (empty($options['parseField'])
230
-                    && ! $alias)
230
+                    && !$alias)
231 231
                 ) {
232 232
                     $isExpr = true;
233 233
                 } elseif (($token->flags & Token::FLAG_KEYWORD_RESERVED)
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
                         continue;
262 262
                     }
263 263
                     $isExpr = true;
264
-                } elseif ($brackets === 0 && strlen($ret->expr) > 0 && ! $alias) {
264
+                } elseif ($brackets === 0 && strlen($ret->expr) > 0 && !$alias) {
265 265
                     /* End of expression */
266 266
                     break;
267 267
                 }
Please login to merge, or discard this patch.
src/Components/AlterOperation.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -223,7 +223,7 @@
 block discarded – undo
223 223
                     // We have reached the end of ALTER operation and suddenly found
224 224
                     // a start to new statement, but have not find a delimiter between them
225 225
 
226
-                    if (! ($token->value == 'SET' && $list->tokens[$list->idx - 1]->value == 'CHARACTER')) {
226
+                    if (!($token->value == 'SET' && $list->tokens[$list->idx - 1]->value == 'CHARACTER')) {
227 227
                         $parser->error(
228 228
                             'A new statement was found, but no delimiter between it and the previous one.',
229 229
                             $token
Please login to merge, or discard this patch.
src/Statement.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -481,7 +481,7 @@
 block discarded – undo
481 481
             if ($clauseStartIdx != -1) {
482 482
                 if ($joinStart == 0 && stripos($clauseType, 'JOIN')) {
483 483
                     $joinStart = 1;
484
-                } elseif ($joinStart == 1 && ! stripos($clauseType, 'JOIN')) {
484
+                } elseif ($joinStart == 1 && !stripos($clauseType, 'JOIN')) {
485 485
                     $joinStart = 2;
486 486
                 } elseif ($joinStart == 2 && stripos($clauseType, 'JOIN')) {
487 487
                     $error = 1;
Please login to merge, or discard this patch.
src/Utils/Formatter.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
                     // pieces only if the clause is not inlined or this fragment
350 350
                     // is between brackets that are on new line.
351 351
                     if (((empty(self::$INLINE_CLAUSES[$lastClause]))
352
-                        && ! $shortGroup
352
+                        && !$shortGroup
353 353
                         && ($this->options['parts_newline']))
354 354
                         || (end($blocksLineEndings) === true)
355 355
                     ) {
@@ -435,9 +435,9 @@  discard block
 block discarded – undo
435 435
             array(
436 436
                 "\x00", "\x01", "\x02", "\x03", "\x04",
437 437
                 "\x05", "\x06", "\x07", "\x08", "\x09", "\x0A",
438
-                "\x0B","\x0C","\x0D", "\x0E", "\x0F", "\x10", "\x11",
439
-                "\x12","\x13","\x14","\x15", "\x16", "\x17", "\x18",
440
-                "\x19","\x1A","\x1B","\x1C","\x1D", "\x1E", "\x1F"
438
+                "\x0B", "\x0C", "\x0D", "\x0E", "\x0F", "\x10", "\x11",
439
+                "\x12", "\x13", "\x14", "\x15", "\x16", "\x17", "\x18",
440
+                "\x19", "\x1A", "\x1B", "\x1C", "\x1D", "\x1E", "\x1F"
441 441
             ),
442 442
             array(
443 443
                 '\x00', '\x01', '\x02', '\x03', '\x04',
Please login to merge, or discard this patch.