Skip to content

Commit dc9ebc1

Browse files
committed
Allow null delimiter
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
1 parent 11cbfcd commit dc9ebc1

3 files changed

Lines changed: 18 additions & 6 deletions

File tree

phpstan-baseline.neon

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,18 +385,28 @@ parameters:
385385
count: 3
386386
path: src/Lexer.php
387387

388+
-
389+
message: "#^Offset int\\<0, max\\> does not exist on string\\|null\\.$#"
390+
count: 1
391+
path: src/Lexer.php
392+
388393
-
389394
message: "#^Parameter \\#1 \\$token of class PhpMyAdmin\\\\SqlParser\\\\Token constructor expects string, null given\\.$#"
390395
count: 1
391396
path: src/Lexer.php
392397

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

398403
-
399-
message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Lexer\\:\\:\\$delimiter \\(string\\) does not accept null\\.$#"
404+
message: "#^Parameter \\#2 \\$needle of function str_ends_with expects string, string\\|null given\\.$#"
405+
count: 1
406+
path: src/Lexer.php
407+
408+
-
409+
message: "#^Parameter \\#3 \\$flags of class PhpMyAdmin\\\\SqlParser\\\\Token constructor expects int, int\\|null given\\.$#"
400410
count: 1
401411
path: src/Lexer.php
402412

psalm-baseline.xml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,8 @@
582582
</NullArgument>
583583
<PossiblyNullArgument>
584584
<code>$flags</code>
585+
<code><![CDATA[$this->delimiter]]></code>
586+
<code><![CDATA[$this->delimiter]]></code>
585587
<code><![CDATA[$this->str[$this->last + 1]]]></code>
586588
<code><![CDATA[$this->str[$this->last]]]></code>
587589
<code><![CDATA[$this->str[$this->last]]]></code>
@@ -598,6 +600,9 @@
598600
<code>$token</code>
599601
<code>$token</code>
600602
</PossiblyNullArgument>
603+
<PossiblyNullArrayAccess>
604+
<code><![CDATA[$this->delimiter[$idx]]]></code>
605+
</PossiblyNullArrayAccess>
601606
<PossiblyNullOperand>
602607
<code><![CDATA[$this->delimiter]]></code>
603608
<code><![CDATA[$this->str[$this->last++]]]></code>
@@ -625,9 +630,6 @@
625630
<code><![CDATA[$this->str[++$this->last]]]></code>
626631
<code><![CDATA[$this->str[++$this->last]]]></code>
627632
</PossiblyNullOperand>
628-
<PossiblyNullPropertyAssignmentValue>
629-
<code>null</code>
630-
</PossiblyNullPropertyAssignmentValue>
631633
<PossiblyNullPropertyFetch>
632634
<code><![CDATA[$next->type]]></code>
633635
<code><![CDATA[$next->value]]></code>

src/Lexer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ class Lexer
9696
* Statements delimiter.
9797
* This may change during lexing.
9898
*/
99-
public string $delimiter;
99+
public string|null $delimiter;
100100

101101
/**
102102
* The length of the delimiter.

0 commit comments

Comments
 (0)