Skip to content

Commit 543c4e9

Browse files
committed
Remove unnecessary elseif
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
1 parent a5e125a commit 543c4e9

2 files changed

Lines changed: 21 additions & 7 deletions

File tree

src/Statements/CreateStatement.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,9 @@ public function build()
479479
. $fields
480480
. OptionsArray::build($this->entityOptions)
481481
. $partition;
482-
} elseif ($this->options->has('VIEW')) {
482+
}
483+
484+
if ($this->options->has('VIEW')) {
483485
$builtStatement = '';
484486
if ($this->select !== null) {
485487
$builtStatement = $this->select->build();
@@ -493,14 +495,18 @@ public function build()
493495
. $fields . ' AS ' . $builtStatement
494496
. (! empty($this->body) ? TokensList::build($this->body) : '') . ' '
495497
. OptionsArray::build($this->entityOptions);
496-
} elseif ($this->options->has('TRIGGER')) {
498+
}
499+
500+
if ($this->options->has('TRIGGER')) {
497501
return 'CREATE '
498502
. OptionsArray::build($this->options) . ' '
499503
. Expression::build($this->name) . ' '
500504
. OptionsArray::build($this->entityOptions) . ' '
501505
. 'ON ' . Expression::build($this->table) . ' '
502506
. 'FOR EACH ROW ' . TokensList::build($this->body);
503-
} elseif ($this->options->has('PROCEDURE') || $this->options->has('FUNCTION')) {
507+
}
508+
509+
if ($this->options->has('PROCEDURE') || $this->options->has('FUNCTION')) {
504510
$tmp = '';
505511
if ($this->options->has('FUNCTION')) {
506512
$tmp = 'RETURNS ' . DataType::build($this->return);

src/Utils/BufferedQuery.php

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

192192
$this->current .= $this->query[$i];
193193
continue;
194-
} elseif ($this->status === self::STATUS_STRING_DOUBLE_QUOTES) {
194+
}
195+
196+
if ($this->status === self::STATUS_STRING_DOUBLE_QUOTES) {
195197
// Double-quoted strings like "bar".
196198
if ($this->query[$i] === '"') {
197199
$this->status = 0;
198200
}
199201

200202
$this->current .= $this->query[$i];
201203
continue;
202-
} elseif ($this->status === self::STATUS_STRING_BACKTICK) {
204+
}
205+
206+
if ($this->status === self::STATUS_STRING_BACKTICK) {
203207
if ($this->query[$i] === '`') {
204208
$this->status = 0;
205209
}
206210

207211
$this->current .= $this->query[$i];
208212
continue;
209-
} elseif (($this->status === self::STATUS_COMMENT_BASH) || ($this->status === self::STATUS_COMMENT_SQL)) {
213+
}
214+
215+
if (($this->status === self::STATUS_COMMENT_BASH) || ($this->status === self::STATUS_COMMENT_SQL)) {
210216
// Bash-like (#) or SQL-like (-- ) comments end in new line.
211217
if ($this->query[$i] === "\n") {
212218
$this->status = 0;
213219
}
214220

215221
$this->current .= $this->query[$i];
216222
continue;
217-
} elseif ($this->status === self::STATUS_COMMENT_C) {
223+
}
224+
225+
if ($this->status === self::STATUS_COMMENT_C) {
218226
// C-like comments end in */.
219227
if (($this->query[$i - 1] === '*') && ($this->query[$i] === '/')) {
220228
$this->status = 0;

0 commit comments

Comments
 (0)