Skip to content

Commit

Permalink
Allow null 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 15, 2024
1 parent 11cbfcd commit dc9ebc1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
14 changes: 12 additions & 2 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -385,18 +385,28 @@ parameters:
count: 3
path: src/Lexer.php

-
message: "#^Offset int\\<0, max\\> does not exist on string\\|null\\.$#"
count: 1
path: src/Lexer.php

-
message: "#^Parameter \\#1 \\$token of class PhpMyAdmin\\\\SqlParser\\\\Token constructor expects string, null given\\.$#"
count: 1
path: src/Lexer.php

-
message: "#^Parameter \\#3 \\$flags of class PhpMyAdmin\\\\SqlParser\\\\Token constructor expects int, int\\|null given\\.$#"
message: "#^Parameter \\#1 \\$token of class PhpMyAdmin\\\\SqlParser\\\\Token constructor expects string, string\\|null given\\.$#"
count: 1
path: src/Lexer.php

-
message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Lexer\\:\\:\\$delimiter \\(string\\) does not accept null\\.$#"
message: "#^Parameter \\#2 \\$needle of function str_ends_with expects string, string\\|null given\\.$#"
count: 1
path: src/Lexer.php

-
message: "#^Parameter \\#3 \\$flags of class PhpMyAdmin\\\\SqlParser\\\\Token constructor expects int, int\\|null given\\.$#"
count: 1
path: src/Lexer.php

Expand Down
8 changes: 5 additions & 3 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,8 @@
</NullArgument>
<PossiblyNullArgument>
<code>$flags</code>
<code><![CDATA[$this->delimiter]]></code>
<code><![CDATA[$this->delimiter]]></code>
<code><![CDATA[$this->str[$this->last + 1]]]></code>
<code><![CDATA[$this->str[$this->last]]]></code>
<code><![CDATA[$this->str[$this->last]]]></code>
Expand All @@ -598,6 +600,9 @@
<code>$token</code>
<code>$token</code>
</PossiblyNullArgument>
<PossiblyNullArrayAccess>
<code><![CDATA[$this->delimiter[$idx]]]></code>
</PossiblyNullArrayAccess>
<PossiblyNullOperand>
<code><![CDATA[$this->delimiter]]></code>
<code><![CDATA[$this->str[$this->last++]]]></code>
Expand Down Expand Up @@ -625,9 +630,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
2 changes: 1 addition & 1 deletion src/Lexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class Lexer
* Statements delimiter.
* This may change during lexing.
*/
public string $delimiter;
public string|null $delimiter;

/**
* The length of the delimiter.
Expand Down

0 comments on commit dc9ebc1

Please sign in to comment.