Skip to content

Commit 04b07f2

Browse files
committed
Fix ParameterDefinition::build
Signed-off-by: Kamil Tekiela <[email protected]>
1 parent 875ce2b commit 04b07f2

File tree

3 files changed

+4
-30
lines changed

3 files changed

+4
-30
lines changed

phpstan-baseline.neon

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -335,11 +335,6 @@ parameters:
335335
count: 2
336336
path: src/Components/OrderKeyword.php
337337

338-
-
339-
message: "#^Parameter \\#1 \\$component of static method PhpMyAdmin\\\\SqlParser\\\\Components\\\\ParameterDefinition\\:\\:build\\(\\) expects array\\<PhpMyAdmin\\\\SqlParser\\\\Components\\\\ParameterDefinition\\>, \\$this\\(PhpMyAdmin\\\\SqlParser\\\\Components\\\\ParameterDefinition\\) given\\.$#"
340-
count: 1
341-
path: src/Components/ParameterDefinition.php
342-
343338
-
344339
message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Components\\\\ParameterDefinition\\:\\:\\$inOut \\(string\\) does not accept string\\|null\\.$#"
345340
count: 1
@@ -365,11 +360,6 @@ parameters:
365360
count: 2
366361
path: src/Components/ParameterDefinition.php
367362

368-
-
369-
message: "#^Unreachable statement \\- code above always terminates\\.$#"
370-
count: 1
371-
path: src/Components/ParameterDefinition.php
372-
373363
-
374364
message: "#^Property PhpMyAdmin\\\\SqlParser\\\\Components\\\\PartitionDefinition\\:\\:\\$expr \\(PhpMyAdmin\\\\SqlParser\\\\Components\\\\Expression\\|string\\) does not accept PhpMyAdmin\\\\SqlParser\\\\Components\\\\Expression\\|null\\.$#"
375365
count: 1
@@ -596,7 +586,7 @@ parameters:
596586
path: src/Statements/CreateStatement.php
597587

598588
-
599-
message: "#^Parameter \\#1 \\$component of static method PhpMyAdmin\\\\SqlParser\\\\Components\\\\ParameterDefinition\\:\\:build\\(\\) expects array\\<PhpMyAdmin\\\\SqlParser\\\\Components\\\\ParameterDefinition\\>, array\\<PhpMyAdmin\\\\SqlParser\\\\Components\\\\ParameterDefinition\\>\\|null given\\.$#"
589+
message: "#^Parameter \\#1 \\$component of static method PhpMyAdmin\\\\SqlParser\\\\Components\\\\ParameterDefinition\\:\\:build\\(\\) expects array\\<PhpMyAdmin\\\\SqlParser\\\\Components\\\\ParameterDefinition\\>\\|PhpMyAdmin\\\\SqlParser\\\\Components\\\\ParameterDefinition, array\\<PhpMyAdmin\\\\SqlParser\\\\Components\\\\ParameterDefinition\\>\\|null given\\.$#"
600590
count: 1
601591
path: src/Statements/CreateStatement.php
602592

@@ -966,7 +956,7 @@ parameters:
966956
path: tests/Builder/CreateStatementTest.php
967957

968958
-
969-
message: "#^Parameter \\#1 \\$component of static method PhpMyAdmin\\\\SqlParser\\\\Components\\\\ParameterDefinition\\:\\:build\\(\\) expects array\\<PhpMyAdmin\\\\SqlParser\\\\Components\\\\ParameterDefinition\\>, array\\<PhpMyAdmin\\\\SqlParser\\\\Components\\\\ParameterDefinition\\>\\|null given\\.$#"
959+
message: "#^Parameter \\#1 \\$component of static method PhpMyAdmin\\\\SqlParser\\\\Components\\\\ParameterDefinition\\:\\:build\\(\\) expects array\\<PhpMyAdmin\\\\SqlParser\\\\Components\\\\ParameterDefinition\\>\\|PhpMyAdmin\\\\SqlParser\\\\Components\\\\ParameterDefinition, array\\<PhpMyAdmin\\\\SqlParser\\\\Components\\\\ParameterDefinition\\>\\|null given\\.$#"
970960
count: 2
971961
path: tests/Builder/CreateStatementTest.php
972962

psalm-baseline.xml

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -491,24 +491,9 @@
491491
</PossiblyNullPropertyAssignmentValue>
492492
</file>
493493
<file src="src/Components/ParameterDefinition.php">
494-
<InvalidArgument>
495-
<code>$this</code>
496-
</InvalidArgument>
497-
<MixedArgument>
498-
<code><![CDATA[$component->name]]></code>
499-
</MixedArgument>
500494
<MixedAssignment>
501495
<code><![CDATA[$expr->name]]></code>
502496
</MixedAssignment>
503-
<MixedOperand>
504-
<code><![CDATA[$component->inOut]]></code>
505-
<code><![CDATA[$component->type]]></code>
506-
</MixedOperand>
507-
<MixedPropertyFetch>
508-
<code><![CDATA[$component->inOut]]></code>
509-
<code><![CDATA[$component->name]]></code>
510-
<code><![CDATA[$component->type]]></code>
511-
</MixedPropertyFetch>
512497
<MoreSpecificImplementedParamType>
513498
<code>$component</code>
514499
</MoreSpecificImplementedParamType>
@@ -519,7 +504,6 @@
519504
<code>DataType::parse($parser, $list)</code>
520505
</PossiblyNullPropertyAssignmentValue>
521506
<RedundantConditionGivenDocblockType>
522-
<code>is_array($component)</code>
523507
<code><![CDATA[isset($expr->name)]]></code>
524508
</RedundantConditionGivenDocblockType>
525509
</file>

src/Components/ParameterDefinition.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ public static function parse(Parser $parser, TokensList $list, array $options =
141141
}
142142

143143
/**
144-
* @param ParameterDefinition[] $component the component to be built
145-
* @param array<string, mixed> $options parameters for building
144+
* @param ParameterDefinition[]|ParameterDefinition $component the component to be built
145+
* @param array<string, mixed> $options parameters for building
146146
*/
147147
public static function build($component, array $options = []): string
148148
{

0 commit comments

Comments
 (0)