Skip to content

Commit 222a5f0

Browse files
committed
chore: improve null checks
Signed-off-by: Fawzi Abdulfattah <[email protected]>
1 parent afe9173 commit 222a5f0

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

src/Statements/KillStatement.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
use PhpMyAdmin\SqlParser\TokensList;
1313

1414
use function array_slice;
15-
use function count;
1615
use function is_int;
1716

1817
/** KILL [HARD|SOFT]
@@ -119,7 +118,7 @@ public function parse(Parser $parser, TokensList $list): void
119118
if ($token->type === Token::TYPE_KEYWORD && $token->value === 'SELECT') {
120119
$subList = new TokensList(array_slice($list->tokens, $list->idx - 1));
121120
$subParser = new Parser($subList);
122-
if (count($subParser->errors)) {
121+
if ($subParser->errors !== []) {
123122
foreach ($subParser->errors as $error) {
124123
$parser->errors[] = $error;
125124
}
@@ -158,19 +157,15 @@ public function build()
158157
{
159158
$ret = 'KILL';
160159

161-
if ($this->options && count($this->options->options) > 0) {
160+
if ($this->options !== null && $this->options->options !== []) {
162161
$ret .= ' ' . OptionsArray::build($this->options);
163162
}
164163

165164
if ($this->IDKeywordUsed) {
166165
$ret .= ' ID';
167166
}
168167

169-
$builtIdentifier = (string) $this->identifier;
170-
if ($this->identifier instanceof Statement) {
171-
$builtIdentifier = $this->identifier->build();
172-
}
173-
168+
$builtIdentifier = $this->identifier;
174169
if ($this->parenthesisUsed) {
175170
$ret .= ' (' . $builtIdentifier . ')';
176171
} elseif ($this->identifier !== null) {

0 commit comments

Comments
 (0)