Skip to content

Commit 87af0c9

Browse files
Merge pull request #468 from kamil-tekiela/remove-elseif
Remove elseif
2 parents d42b402 + 543c4e9 commit 87af0c9

3 files changed

Lines changed: 21 additions & 9 deletions

File tree

src/Components/ParameterDefinition.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,6 @@ public static function parse(Parser $parser, TokensList $list, array $options =
104104
if (($token->type === Token::TYPE_OPERATOR) && ($token->value === '(')) {
105105
$state = 1;
106106
}
107-
108-
continue;
109107
} elseif ($state === 1) {
110108
if (($token->value === 'IN') || ($token->value === 'OUT') || ($token->value === 'INOUT')) {
111109
$expr->inOut = $token->value;

src/Statements/CreateStatement.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,9 @@ public function build(): string
476476
. $fields
477477
. OptionsArray::build($this->entityOptions)
478478
. $partition;
479-
} elseif ($this->options->has('VIEW')) {
479+
}
480+
481+
if ($this->options->has('VIEW')) {
480482
$builtStatement = '';
481483
if ($this->select !== null) {
482484
$builtStatement = $this->select->build();
@@ -490,14 +492,18 @@ public function build(): string
490492
. $fields . ' AS ' . $builtStatement
491493
. (! empty($this->body) ? TokensList::build($this->body) : '') . ' '
492494
. OptionsArray::build($this->entityOptions);
493-
} elseif ($this->options->has('TRIGGER')) {
495+
}
496+
497+
if ($this->options->has('TRIGGER')) {
494498
return 'CREATE '
495499
. OptionsArray::build($this->options) . ' '
496500
. Expression::build($this->name) . ' '
497501
. OptionsArray::build($this->entityOptions) . ' '
498502
. 'ON ' . Expression::build($this->table) . ' '
499503
. 'FOR EACH ROW ' . TokensList::build($this->body);
500-
} elseif ($this->options->has('PROCEDURE') || $this->options->has('FUNCTION')) {
504+
}
505+
506+
if ($this->options->has('PROCEDURE') || $this->options->has('FUNCTION')) {
501507
$tmp = '';
502508
if ($this->options->has('FUNCTION')) {
503509
$tmp = 'RETURNS ' . DataType::build($this->return);

src/Utils/BufferedQuery.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,30 +189,38 @@ public function extract($end = false)
189189

190190
$this->current .= $this->query[$i];
191191
continue;
192-
} elseif ($this->status === self::STATUS_STRING_DOUBLE_QUOTES) {
192+
}
193+
194+
if ($this->status === self::STATUS_STRING_DOUBLE_QUOTES) {
193195
// Double-quoted strings like "bar".
194196
if ($this->query[$i] === '"') {
195197
$this->status = 0;
196198
}
197199

198200
$this->current .= $this->query[$i];
199201
continue;
200-
} elseif ($this->status === self::STATUS_STRING_BACKTICK) {
202+
}
203+
204+
if ($this->status === self::STATUS_STRING_BACKTICK) {
201205
if ($this->query[$i] === '`') {
202206
$this->status = 0;
203207
}
204208

205209
$this->current .= $this->query[$i];
206210
continue;
207-
} elseif (($this->status === self::STATUS_COMMENT_BASH) || ($this->status === self::STATUS_COMMENT_SQL)) {
211+
}
212+
213+
if (($this->status === self::STATUS_COMMENT_BASH) || ($this->status === self::STATUS_COMMENT_SQL)) {
208214
// Bash-like (#) or SQL-like (-- ) comments end in new line.
209215
if ($this->query[$i] === "\n") {
210216
$this->status = 0;
211217
}
212218

213219
$this->current .= $this->query[$i];
214220
continue;
215-
} elseif ($this->status === self::STATUS_COMMENT_C) {
221+
}
222+
223+
if ($this->status === self::STATUS_COMMENT_C) {
216224
// C-like comments end in */.
217225
if (($this->query[$i - 1] === '*') && ($this->query[$i] === '/')) {
218226
$this->status = 0;

0 commit comments

Comments
 (0)