Skip to content

Commit fe490db

Browse files
Merge pull request #521 from kamil-tekiela/param-types-3
Add native param types
2 parents 25a0713 + b475467 commit fe490db

39 files changed

+122
-137
lines changed

psalm-baseline.xml

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -646,15 +646,6 @@
646646
<code><![CDATA[self::STATEMENT_PARSERS[$statementName ?? $token->keyword]]]></code>
647647
<code><![CDATA[self::STATEMENT_PARSERS[$token->keyword]]]></code>
648648
</MixedArrayOffset>
649-
<PossiblyNullArgument>
650-
<code>$list</code>
651-
<code>$list</code>
652-
<code>$list</code>
653-
<code><![CDATA[$token->token]]></code>
654-
</PossiblyNullArgument>
655-
<PossiblyNullArrayAccess>
656-
<code><![CDATA[$list->tokens[$list->idx]]]></code>
657-
</PossiblyNullArrayAccess>
658649
<PossiblyNullArrayOffset>
659650
<code><![CDATA[$list->tokens]]></code>
660651
<code>self::STATEMENT_PARSERS</code>
@@ -664,27 +655,9 @@
664655
<code><![CDATA[$list->idx]]></code>
665656
<code>$prevLastIdx</code>
666657
</PossiblyNullOperand>
667-
<PossiblyNullPropertyAssignment>
668-
<code>$list</code>
669-
<code>$list</code>
670-
</PossiblyNullPropertyAssignment>
671658
<PossiblyNullPropertyAssignmentValue>
672659
<code>$lastIdx</code>
673660
</PossiblyNullPropertyAssignmentValue>
674-
<PossiblyNullPropertyFetch>
675-
<code><![CDATA[$list->count]]></code>
676-
<code><![CDATA[$list->idx]]></code>
677-
<code><![CDATA[$list->tokens]]></code>
678-
<code><![CDATA[$token->keyword]]></code>
679-
<code><![CDATA[$token->token]]></code>
680-
<code><![CDATA[$token->type]]></code>
681-
<code><![CDATA[$token->value]]></code>
682-
</PossiblyNullPropertyFetch>
683-
<PossiblyNullReference>
684-
<code>getNextOfType</code>
685-
<code>getNextOfType</code>
686-
<code>getNextOfType</code>
687-
</PossiblyNullReference>
688661
<UnsupportedPropertyReferenceUsage>
689662
<code><![CDATA[$list = &$this->list]]></code>
690663
</UnsupportedPropertyReferenceUsage>
@@ -1053,8 +1026,6 @@
10531026
<code>$idx</code>
10541027
</MixedArgumentTypeCoercion>
10551028
<PossiblyFalseArgument>
1056-
<code>$params</code>
1057-
<code>$params</code>
10581029
<code><![CDATA[$params['c']]]></code>
10591030
<code><![CDATA[$params['q']]]></code>
10601031
<code><![CDATA[$params['q']]]></code>
@@ -1542,13 +1513,6 @@
15421513
<code><![CDATA[$parser->list]]></code>
15431514
<code><![CDATA[$parser->list]]></code>
15441515
<code><![CDATA[$parser->list]]></code>
1545-
<code><![CDATA[$parser->list]]></code>
1546-
<code><![CDATA[$parser->list]]></code>
1547-
<code><![CDATA[$parser->list]]></code>
1548-
<code><![CDATA[$parser->list]]></code>
1549-
<code><![CDATA[$parser->list]]></code>
1550-
<code><![CDATA[$parser->list]]></code>
1551-
<code><![CDATA[$parser->list]]></code>
15521516
</PossiblyNullArgument>
15531517
<PossiblyUnusedMethod>
15541518
<code>getFlagsProvider</code>

src/Components/AlterOperation.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,9 @@ final class AlterOperation implements Component
264264
* @param Token[] $unknown unparsed tokens found at the end of operation
265265
*/
266266
public function __construct(
267-
$options = null,
268-
$field = null,
269-
$partitions = null,
267+
OptionsArray|null $options = null,
268+
Expression|string|null $field = null,
269+
array|null $partitions = null,
270270
public array $unknown = []
271271
) {
272272
$this->partitions = $partitions;
@@ -527,7 +527,7 @@ public function build(): string
527527
*
528528
* @param string $tokenValue Value of current token
529529
*/
530-
private static function checkIfColumnDefinitionKeyword($tokenValue): bool
530+
private static function checkIfColumnDefinitionKeyword(string $tokenValue): bool
531531
{
532532
$commonOptions = [
533533
'AUTO_INCREMENT',
@@ -551,7 +551,7 @@ private static function checkIfColumnDefinitionKeyword($tokenValue): bool
551551
*
552552
* @param Token $token token to check
553553
*/
554-
private static function checkIfTokenQuotedSymbol($token): bool
554+
private static function checkIfTokenQuotedSymbol(Token $token): bool
555555
{
556556
return $token->type === TokenType::Symbol && $token->flags === Token::FLAG_SYMBOL_BACKTICK;
557557
}

src/Components/Condition.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ final class Condition implements Component
8080
/**
8181
* @param string $expr the condition or the operator
8282
*/
83-
public function __construct($expr = null)
83+
public function __construct(string|null $expr = null)
8484
{
8585
$this->expr = trim((string) $expr);
8686
}

src/Components/CreateDefinition.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,11 @@ final class CreateDefinition implements Component
150150
* @param Reference|null $references references
151151
*/
152152
public function __construct(
153-
$name = null,
154-
$options = null,
155-
$type = null,
156-
$isConstraint = false,
157-
$references = null
153+
string|null $name = null,
154+
OptionsArray|null $options = null,
155+
DataType|Key|null $type = null,
156+
bool $isConstraint = false,
157+
Reference|null $references = null
158158
) {
159159
$this->name = $name;
160160
$this->options = $options;

src/Components/DataType.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ final class DataType implements Component
7878
* @param OptionsArray $options the options of this data type
7979
*/
8080
public function __construct(
81-
$name = null,
81+
string|null $name = null,
8282
array $parameters = [],
83-
$options = null
83+
OptionsArray|null $options = null
8484
) {
8585
$this->name = $name;
8686
$this->parameters = $parameters;

src/Components/Expression.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,12 @@ final class Expression implements Component
110110
* @param string|null $column the name of the column
111111
* @param string|null $alias the name of the alias
112112
*/
113-
public function __construct($database = null, $table = null, $column = null, $alias = null)
114-
{
113+
public function __construct(
114+
string|null $database = null,
115+
string|null $table = null,
116+
string|null $column = null,
117+
string|null $alias = null
118+
) {
115119
if (($column === null) && ($alias === null)) {
116120
$this->expr = $database; // case 1
117121
$this->alias = $table; // case 2

src/Components/FunctionCall.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ final class FunctionCall implements Component
3434
* @param string|null $name the name of the function to be called
3535
* @param string[]|ArrayObj|null $parameters the parameters of this function
3636
*/
37-
public function __construct($name = null, $parameters = null)
37+
public function __construct(string|null $name = null, array|ArrayObj|null $parameters = null)
3838
{
3939
$this->name = $name;
4040
if (is_array($parameters)) {

src/Components/GroupKeyword.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ final class GroupKeyword implements Component
3030
/**
3131
* @param Expression $expr the expression that we are sorting by
3232
*/
33-
public function __construct($expr = null)
33+
public function __construct(Expression|null $expr = null)
3434
{
3535
$this->expr = $expr;
3636
}

src/Components/IntoKeyword.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,12 @@ final class IntoKeyword implements Component
113113
* @param bool|null $fieldsKeyword options for OPTIONS keyword
114114
*/
115115
public function __construct(
116-
$type = null,
117-
$dest = null,
118-
$columns = null,
119-
$values = null,
120-
$fieldsOptions = null,
121-
$fieldsKeyword = null
116+
string|null $type = null,
117+
string|Expression|null $dest = null,
118+
array|null $columns = null,
119+
array|null $values = null,
120+
OptionsArray|null $fieldsOptions = null,
121+
bool|null $fieldsKeyword = null
122122
) {
123123
$this->type = $type;
124124
$this->dest = $dest;
@@ -236,7 +236,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
236236
* @param TokensList $list A token list
237237
* @param string $keyword The keyword
238238
*/
239-
public function parseFileOptions(Parser $parser, TokensList $list, $keyword = 'FIELDS'): void
239+
public function parseFileOptions(Parser $parser, TokensList $list, string $keyword = 'FIELDS'): void
240240
{
241241
++$list->idx;
242242

src/Components/JoinKeyword.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,12 @@ final class JoinKeyword implements Component
7878
* @param Condition[] $on join conditions
7979
* @param ArrayObj $using columns joined
8080
*/
81-
public function __construct($type = null, $expr = null, $on = null, $using = null)
82-
{
81+
public function __construct(
82+
string|null $type = null,
83+
Expression|null $expr = null,
84+
array|null $on = null,
85+
ArrayObj|null $using = null
86+
) {
8387
$this->type = $type;
8488
$this->expr = $expr;
8589
$this->on = $on;

0 commit comments

Comments
 (0)