Skip to content

Commit

Permalink
Don't assign null to $delimiter
Browse files Browse the repository at this point in the history
Signed-off-by: Kamil Tekiela <[email protected]>
  • Loading branch information
kamil-tekiela committed Jan 16, 2024
1 parent fe06c29 commit 5f7535e
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 11 deletions.
5 changes: 0 additions & 5 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -385,11 +385,6 @@ parameters:
count: 3
path: src/Lexer.php

-
message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Lexer\\:\\:\\$delimiter \\(string\\) does not accept null\\.$#"
count: 1
path: src/Lexer.php

-
message: "#^Strict comparison using \\=\\=\\= between non\\-empty\\-array\\<non\\-empty\\-string, int\\> and array\\{\\} will always evaluate to false\\.$#"
count: 1
Expand Down
4 changes: 0 additions & 4 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,6 @@
<code>$token</code>
</PossiblyNullArgument>
<PossiblyNullOperand>
<code><![CDATA[$this->delimiter]]></code>
<code><![CDATA[$this->str[$this->last++]]]></code>
<code><![CDATA[$this->str[$this->last++]]]></code>
<code><![CDATA[$this->str[$this->last]]]></code>
Expand All @@ -616,9 +615,6 @@
<code><![CDATA[$this->str[++$this->last]]]></code>
<code><![CDATA[$this->str[++$this->last]]]></code>
</PossiblyNullOperand>
<PossiblyNullPropertyAssignmentValue>
<code>null</code>
</PossiblyNullPropertyAssignmentValue>
<PossiblyNullPropertyFetch>
<code><![CDATA[$next->type]]></code>
<code><![CDATA[$next->value]]></code>
Expand Down
4 changes: 2 additions & 2 deletions src/Lexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ public function lex(): void
$pos = $this->last + 1;

// Parsing the delimiter.
$this->delimiter = null;
$this->delimiter = '';
$delimiterLen = 0;
while (
++$this->last < $this->len

Check warning on line 245 in src/Lexer.php

View workflow job for this annotation

GitHub Actions / Mutation tests with PHP 8.1

Escaped Mutant for Mutator "LessThan": --- Original +++ New @@ @@ // Parsing the delimiter. $this->delimiter = ''; $delimiterLen = 0; - while (++$this->last < $this->len && !Context::isWhitespace($this->str[$this->last]) && $delimiterLen < 15) { + while (++$this->last <= $this->len && !Context::isWhitespace($this->str[$this->last]) && $delimiterLen < 15) { $this->delimiter .= $this->str[$this->last]; ++$delimiterLen; }
Expand All @@ -250,7 +250,7 @@ public function lex(): void
++$delimiterLen;
}

if (empty($this->delimiter)) {
if ($this->delimiter === '') {
$this->error('Expected delimiter.', '', $this->last);
$this->delimiter = ';';
}
Expand Down

0 comments on commit 5f7535e

Please sign in to comment.