Skip to content

Commit e860cf9

Browse files
committed
Fix some coding standard issues
Signed-off-by: Maurício Meneghini Fauth <[email protected]>
1 parent e7f4397 commit e860cf9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+188
-7
lines changed

src/Components/AlterOperation.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
224224
// included to not break anything.
225225
$ret->unknown[] = $token;
226226
}
227+
227228
continue;
228229
}
229230

@@ -235,8 +236,10 @@ public static function parse(Parser $parser, TokensList $list, array $options =
235236
if ($list->tokens[$list->idx]->type === Token::TYPE_DELIMITER) {
236237
break;
237238
}
239+
238240
$ret->unknown[] = $list->tokens[$list->idx];
239241
}
242+
240243
break;
241244
}
242245

@@ -255,6 +258,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
255258
// iteration will parse the same token, but in state 2.
256259
--$list->idx;
257260
}
261+
258262
$state = 2;
259263
} elseif ($state === 2) {
260264
if ($token->type === Token::TYPE_OPERATOR) {
@@ -287,6 +291,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
287291
);
288292
break;
289293
}
294+
290295
$ret->unknown[] = $token;
291296
}
292297
}
@@ -315,6 +320,7 @@ public static function build($component, array $options = [])
315320
if (isset($component->field) && ($component->field !== '')) {
316321
$ret .= $component->field . ' ';
317322
}
323+
318324
$ret .= TokensList::build($component->unknown);
319325

320326
return $ret;
@@ -341,6 +347,7 @@ private static function checkIfColumnDefinitionKeyword($tokenValue)
341347
'PRIMARY KEY',
342348
'UNIQUE KEY',
343349
];
350+
344351
// Since these options can be used for
345352
// both table as well as a specific column in the table
346353
return in_array($tokenValue, $common_options);

src/Components/Array2d.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
8888
$token
8989
);
9090
}
91+
9192
$ret[] = $arr;
9293
$state = 1;
9394
} else {

src/Components/ArrayObj.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
127127
$lastRaw = $lastValue = '';
128128
}
129129
}
130+
130131
continue;
131132
}
132133
}

src/Components/CaseExpression.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
224224
$parser->error('Potential duplicate alias of CASE expression.', $token);
225225
break;
226226
}
227+
227228
$asFound = true;
228229
continue;
229230
}
@@ -246,6 +247,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
246247
$parser->error('An alias was previously found.', $token);
247248
break;
248249
}
250+
249251
$ret->alias = $token->value;
250252
$asFound = false;
251253

@@ -254,6 +256,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
254256

255257
break;
256258
}
259+
257260
if ($asFound) {
258261
$parser->error('An alias was expected after AS.', $list->tokens[$list->idx - 1]);
259262
}
@@ -293,9 +296,11 @@ public static function build($component, array $options = [])
293296
$ret .= 'THEN ' . $component->results[$i] . ' ';
294297
}
295298
}
299+
296300
if (isset($component->else_result)) {
297301
$ret .= 'ELSE ' . $component->else_result . ' ';
298302
}
303+
299304
$ret .= 'END';
300305

301306
if ($component->alias) {

src/Components/Condition.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
170170
if ($token->value === 'BETWEEN') {
171171
$betweenBefore = true;
172172
}
173+
173174
if (($brackets === 0) && empty(static::$ALLOWED_KEYWORDS[$token->value])) {
174175
break;
175176
}
@@ -182,6 +183,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
182183
if ($brackets === 0) {
183184
break;
184185
}
186+
185187
--$brackets;
186188
}
187189
}

src/Components/CreateDefinition.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,11 +279,13 @@ public static function parse(Parser $parser, TokensList $list, array $options =
279279
} else {
280280
--$list->idx;
281281
}
282+
282283
$state = 5;
283284
} elseif ($state === 5) {
284285
if (! empty($expr->type) || ! empty($expr->key)) {
285286
$ret[] = $expr;
286287
}
288+
287289
$expr = new static();
288290
if ($token->value === ',') {
289291
$state = 1;

src/Components/DataType.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
125125
if (($token->type !== Token::TYPE_KEYWORD) || (! ($token->flags & Token::FLAG_KEYWORD_DATA_TYPE))) {
126126
$parser->error('Unrecognized data type.', $token);
127127
}
128+
128129
$state = 1;
129130
} elseif ($state === 1) {
130131
if (($token->type === Token::TYPE_OPERATOR) && ($token->value === '(')) {
@@ -133,6 +134,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
133134
$ret->parameters = ($ret->name === 'ENUM') || ($ret->name === 'SET') ?
134135
$parameters->raw : $parameters->values;
135136
}
137+
136138
$ret->options = OptionsArray::parse($parser, $list, static::$DATA_TYPE_OPTIONS);
137139
++$list->idx;
138140
break;

src/Components/Expression.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
217217
if ($isExpr) {
218218
$ret->expr .= $token->token;
219219
}
220+
220221
continue;
221222
}
222223

@@ -241,17 +242,20 @@ public static function parse(Parser $parser, TokensList $list, array $options =
241242
// ended and a new clause is starting.
242243
break;
243244
}
245+
244246
if ($token->keyword === 'AS') {
245247
if (! empty($options['breakOnAlias'])) {
246248
break;
247249
}
250+
248251
if ($alias) {
249252
$parser->error(
250253
'An alias was expected.',
251254
$token
252255
);
253256
break;
254257
}
258+
255259
$alias = true;
256260
continue;
257261
} elseif ($token->keyword === 'CASE') {
@@ -262,6 +266,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
262266
$isExpr = true;
263267
continue;
264268
}
269+
265270
$isExpr = true;
266271
} elseif ($brackets === 0 && strlen((string) $ret->expr) > 0 && ! $alias) {
267272
/* End of expression */
@@ -294,6 +299,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
294299
// No brackets were expected.
295300
break;
296301
}
302+
297303
if ($token->value === '(') {
298304
++$brackets;
299305
if (empty($ret->function) && ($prev[1] !== null)
@@ -342,6 +348,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
342348
$parser->error('An alias was previously found.', $token);
343349
break;
344350
}
351+
345352
$ret->alias = $token->value;
346353
$alias = false;
347354
} elseif ($isExpr) {
@@ -361,6 +368,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
361368
$parser->error('An alias was previously found.', $token);
362369
break;
363370
}
371+
364372
$ret->alias = $prev[1]->value;
365373
} else {
366374
$ret->expr .= $token->token;
@@ -373,6 +381,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
373381
if (! empty($ret->database) || $dot) {
374382
$parser->error('Unexpected dot.', $token);
375383
}
384+
376385
$ret->database = $ret->table;
377386
$ret->table = $ret->column;
378387
$ret->column = null;
@@ -389,10 +398,12 @@ public static function parse(Parser $parser, TokensList $list, array $options =
389398
if (! empty($options['breakOnAlias'])) {
390399
break;
391400
}
401+
392402
if (! empty($ret->alias)) {
393403
$parser->error('An alias was previously found.', $token);
394404
break;
395405
}
406+
396407
$ret->alias = $token->value;
397408
}
398409
}
@@ -437,12 +448,15 @@ public static function build($component, array $options = [])
437448
if (isset($component->database) && ($component->database !== '')) {
438449
$fields[] = $component->database;
439450
}
451+
440452
if (isset($component->table) && ($component->table !== '')) {
441453
$fields[] = $component->table;
442454
}
455+
443456
if (isset($component->column) && ($component->column !== '')) {
444457
$fields[] = $component->column;
445458
}
459+
446460
$ret = implode('.', Context::escape($fields));
447461
}
448462

src/Components/ExpressionArray.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
8282
if ($expr === null) {
8383
break;
8484
}
85+
8586
$ret[] = $expr;
8687
$state = 1;
8788
} elseif ($state === 1) {

src/Components/FunctionCall.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
9393
if (($token->type === Token::TYPE_OPERATOR) && ($token->value === '(')) {
9494
$ret->parameters = ArrayObj::parse($parser, $list);
9595
}
96+
9697
break;
9798
}
9899
}

src/Components/GroupKeyword.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
9292
if (! empty($expr->expr)) {
9393
$ret[] = $expr;
9494
}
95+
9596
$expr = new static();
9697
$state = 0;
9798
} else {

src/Components/IndexHint.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
9090
if ($list->idx > 0) {
9191
--$list->idx;
9292
}
93+
9394
for (; $list->idx < $list->count; ++$list->idx) {
9495
/**
9596
* Token parsed at this moment.
@@ -102,6 +103,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
102103
if ($token->type === Token::TYPE_DELIMITER) {
103104
break;
104105
}
106+
105107
// Skipping whitespaces and comments.
106108
if (($token->type === Token::TYPE_WHITESPACE) || ($token->type === Token::TYPE_COMMENT)) {
107109
continue;
@@ -117,6 +119,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
117119
break 2;
118120
}
119121
}
122+
120123
break;
121124
case 1:
122125
if ($token->type === Token::TYPE_KEYWORD) {
@@ -125,11 +128,13 @@ public static function parse(Parser $parser, TokensList $list, array $options =
125128
} else {
126129
$parser->error('Unexpected keyword.', $token);
127130
}
131+
128132
$state = 2;
129133
} else {
130134
// we expect the token to be a keyword
131135
$parser->error('Unexpected token.', $token);
132136
}
137+
133138
break;
134139
case 2:
135140
if ($token->type === Token::TYPE_KEYWORD && $token->keyword === 'FOR') {
@@ -140,6 +145,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
140145
$ret[] = $expr;
141146
$expr = new static();
142147
}
148+
143149
break;
144150
case 3:
145151
if ($token->type === Token::TYPE_KEYWORD) {
@@ -148,11 +154,13 @@ public static function parse(Parser $parser, TokensList $list, array $options =
148154
} else {
149155
$parser->error('Unexpected keyword.', $token);
150156
}
157+
151158
$state = 4;
152159
} else {
153160
// we expect the token to be a keyword
154161
$parser->error('Unexpected token.', $token);
155162
}
163+
156164
break;
157165
case 4:
158166
$expr->indexes = ExpressionArray::parse($parser, $list);
@@ -162,6 +170,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
162170
break;
163171
}
164172
}
173+
165174
--$list->idx;
166175

167176
return $ret;
@@ -183,6 +192,7 @@ public static function build($component, array $options = [])
183192
if ($component->for !== null) {
184193
$ret .= 'FOR ' . $component->for . ' ';
185194
}
195+
186196
return $ret . ExpressionArray::build($component->indexes);
187197
}
188198
}

src/Components/IntoKeyword.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,12 +205,14 @@ public static function parse(Parser $parser, TokensList $list, array $options =
205205
} else {
206206
$ret->values = ExpressionArray::parse($parser, $list);
207207
}
208+
208209
$state = 1;
209210
} elseif ($state === 1) {
210211
if (($token->type === Token::TYPE_OPERATOR) && ($token->value === '(')) {
211212
$ret->columns = ArrayObj::parse($parser, $list)->values;
212213
++$list->idx;
213214
}
215+
214216
break;
215217
} elseif ($state === 2) {
216218
$ret->dest = $token->value;

src/Components/JoinKeyword.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
175175
/* Next clause is starting */
176176
break 2;
177177
}
178+
178179
break;
179180
}
180181
}

src/Components/Key.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ public static function build($component, array $options = [])
201201
if (isset($column['length'])) {
202202
$tmp .= '(' . $column['length'] . ')';
203203
}
204+
204205
$columns[] = $tmp;
205206
}
206207

src/Components/Limit.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
7979
if ($offset) {
8080
$parser->error('An offset was expected.', $token);
8181
}
82+
8283
$offset = true;
8384
continue;
8485
}

0 commit comments

Comments
 (0)