Skip to content

Commit f9c7db5

Browse files
committed
Merge #479 - $name property can never be a string
Pull-request: #479 Signed-off-by: William Desportes <[email protected]>
2 parents de86368 + 804ce5a commit f9c7db5

File tree

4 files changed

+3
-16
lines changed

4 files changed

+3
-16
lines changed

phpstan-baseline.neon

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -620,11 +620,6 @@ parameters:
620620
count: 1
621621
path: src/Statements/CreateStatement.php
622622

623-
-
624-
message: "#^Strict comparison using \\=\\=\\= between PhpMyAdmin\\\\SqlParser\\\\Components\\\\Expression and '' will always evaluate to false\\.$#"
625-
count: 1
626-
path: src/Statements/CreateStatement.php
627-
628623
-
629624
message: "#^array\\<PhpMyAdmin\\\\SqlParser\\\\Token\\>\\|string does not accept PhpMyAdmin\\\\SqlParser\\\\Token\\.$#"
630625
count: 4

psalm-baseline.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -990,10 +990,6 @@
990990
</PossiblyNullPropertyFetch>
991991
</file>
992992
<file src="src/Statements/CreateStatement.php">
993-
<DocblockTypeContradiction>
994-
<code><![CDATA[$this->name === '']]></code>
995-
<code><![CDATA[$this->name === '']]></code>
996-
</DocblockTypeContradiction>
997993
<MixedArgument>
998994
<code><![CDATA[$this->$field]]></code>
999995
</MixedArgument>

src/Components/Expression.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,9 @@ public function __construct($database = null, $table = null, $column = null, $al
155155
* @param TokensList $list the list of tokens that are being parsed
156156
* @param array<string, mixed> $options parameters for parsing
157157
*
158-
* @return Expression|null
159-
*
160158
* @throws ParserException
161159
*/
162-
public static function parse(Parser $parser, TokensList $list, array $options = [])
160+
public static function parse(Parser $parser, TokensList $list, array $options = []): Expression|null
163161
{
164162
$ret = new static();
165163

src/Statements/CreateStatement.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -279,10 +279,8 @@ class CreateStatement extends Statement
279279
* The name of the entity that is created.
280280
*
281281
* Used by all `CREATE` statements.
282-
*
283-
* @var Expression|null
284282
*/
285-
public $name;
283+
public Expression|null $name = null;
286284

287285
/**
288286
* The options of the entity (table, procedure, function, etc.).
@@ -548,7 +546,7 @@ public function parse(Parser $parser, TokensList $list): void
548546
]
549547
);
550548

551-
if (! isset($this->name) || ($this->name === '')) {
549+
if ($this->name === null) {
552550
$parser->error('The name of the entity was expected.', $list->tokens[$list->idx]);
553551
} else {
554552
++$list->idx; // Skipping field.

0 commit comments

Comments
 (0)