Skip to content

Commit d91ff58

Browse files
committed
Add null to properties not set in constructors
Fixes Psalm's PropertyNotSetInConstructor issues. Signed-off-by: Maurício Meneghini Fauth <[email protected]>
1 parent 15d6d27 commit d91ff58

30 files changed

+674
-798
lines changed

phpstan-baseline.neon

Lines changed: 226 additions & 261 deletions
Large diffs are not rendered by default.

psalm-baseline.xml

Lines changed: 324 additions & 411 deletions
Large diffs are not rendered by default.

src/Components/CaseExpression.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class CaseExpression extends Component
2525
/**
2626
* The value to be compared.
2727
*
28-
* @var Expression
28+
* @var Expression|null
2929
*/
3030
public $value;
3131

@@ -53,14 +53,14 @@ class CaseExpression extends Component
5353
/**
5454
* The result in ELSE section of expr.
5555
*
56-
* @var Expression
56+
* @var Expression|null
5757
*/
5858
public $else_result;
5959

6060
/**
6161
* The alias of this CASE statement.
6262
*
63-
* @var string
63+
* @var string|null
6464
*/
6565
public $alias;
6666

src/Components/CreateDefinition.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -110,51 +110,51 @@ class CreateDefinition extends Component
110110
/**
111111
* The name of the new column.
112112
*
113-
* @var string
113+
* @var string|null
114114
*/
115115
public $name;
116116

117117
/**
118118
* Whether this field is a constraint or not.
119119
*
120-
* @var bool
120+
* @var bool|null
121121
*/
122122
public $isConstraint;
123123

124124
/**
125125
* The data type of thew new column.
126126
*
127-
* @var DataType
127+
* @var DataType|null
128128
*/
129129
public $type;
130130

131131
/**
132132
* The key.
133133
*
134-
* @var Key
134+
* @var Key|null
135135
*/
136136
public $key;
137137

138138
/**
139139
* The table that is referenced.
140140
*
141-
* @var Reference
141+
* @var Reference|null
142142
*/
143143
public $references;
144144

145145
/**
146146
* The options of this field.
147147
*
148-
* @var OptionsArray
148+
* @var OptionsArray|null
149149
*/
150150
public $options;
151151

152152
/**
153-
* @param string $name the name of the field
154-
* @param OptionsArray $options the options of this field
155-
* @param DataType|Key $type the data type of this field or the key
156-
* @param bool $isConstraint whether this field is a constraint or not
157-
* @param Reference $references references
153+
* @param string|null $name the name of the field
154+
* @param OptionsArray|null $options the options of this field
155+
* @param DataType|Key|null $type the data type of this field or the key
156+
* @param bool $isConstraint whether this field is a constraint or not
157+
* @param Reference|null $references references
158158
*/
159159
public function __construct(
160160
$name = null,

src/Components/Expression.php

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,35 +52,35 @@ class Expression extends Component
5252
/**
5353
* The name of this database.
5454
*
55-
* @var string
55+
* @var string|null
5656
*/
5757
public $database;
5858

5959
/**
6060
* The name of this table.
6161
*
62-
* @var string
62+
* @var string|null
6363
*/
6464
public $table;
6565

6666
/**
6767
* The name of the column.
6868
*
69-
* @var string
69+
* @var string|null
7070
*/
7171
public $column;
7272

7373
/**
7474
* The sub-expression.
7575
*
76-
* @var string
76+
* @var string|null
7777
*/
7878
public $expr = '';
7979

8080
/**
8181
* The alias of this expression.
8282
*
83-
* @var string
83+
* @var string|null
8484
*/
8585
public $alias;
8686

@@ -94,7 +94,7 @@ class Expression extends Component
9494
/**
9595
* The type of subquery.
9696
*
97-
* @var string
97+
* @var string|null
9898
*/
9999
public $subquery;
100100

@@ -108,12 +108,10 @@ class Expression extends Component
108108
* If the database, table or column name is not required, pass an empty
109109
* string.
110110
*
111-
* @param string $database The name of the database or the the expression.
112-
* the the expression.
113-
* @param string $table The name of the table or the alias of the expression.
114-
* the alias of the expression.
115-
* @param string $column the name of the column
116-
* @param string $alias the name of the alias
111+
* @param string|null $database The name of the database or the expression.
112+
* @param string|null $table The name of the table or the alias of the expression.
113+
* @param string|null $column the name of the column
114+
* @param string|null $alias the name of the alias
117115
*/
118116
public function __construct($database = null, $table = null, $column = null, $alias = null)
119117
{

src/Components/FunctionCall.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,20 @@ class FunctionCall extends Component
2424
/**
2525
* The name of this function.
2626
*
27-
* @var string
27+
* @var string|null
2828
*/
2929
public $name;
3030

3131
/**
3232
* The list of parameters.
3333
*
34-
* @var ArrayObj
34+
* @var ArrayObj|null
3535
*/
3636
public $parameters;
3737

3838
/**
39-
* @param string $name the name of the function to be called
40-
* @param array|ArrayObj $parameters the parameters of this function
39+
* @param string|null $name the name of the function to be called
40+
* @param array|ArrayObj|null $parameters the parameters of this function
4141
*/
4242
public function __construct($name = null, $parameters = null)
4343
{

src/Components/IntoKeyword.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -62,28 +62,28 @@ class IntoKeyword extends Component
6262
/**
6363
* Type of target (OUTFILE or SYMBOL).
6464
*
65-
* @var string
65+
* @var string|null
6666
*/
6767
public $type;
6868

6969
/**
7070
* The destination, which can be a table or a file.
7171
*
72-
* @var string|Expression
72+
* @var string|Expression|null
7373
*/
7474
public $dest;
7575

7676
/**
7777
* The name of the columns.
7878
*
79-
* @var array
79+
* @var array|null
8080
*/
8181
public $columns;
8282

8383
/**
8484
* The values to be selected into (SELECT .. INTO @var1).
8585
*
86-
* @var Expression[]
86+
* @var Expression[]|null
8787
*/
8888
public $values;
8989

@@ -92,14 +92,14 @@ class IntoKeyword extends Component
9292
*
9393
* @see static::$FIELDS_OPTIONS
9494
*
95-
* @var OptionsArray
95+
* @var OptionsArray|null
9696
*/
9797
public $fields_options;
9898

9999
/**
100100
* Whether to use `FIELDS` or `COLUMNS` while building.
101101
*
102-
* @var bool
102+
* @var bool|null
103103
*/
104104
public $fields_keyword;
105105

@@ -108,17 +108,17 @@ class IntoKeyword extends Component
108108
*
109109
* @see static::$LINES_OPTIONS
110110
*
111-
* @var OptionsArray
111+
* @var OptionsArray|null
112112
*/
113113
public $lines_options;
114114

115115
/**
116-
* @param string $type type of destination (may be OUTFILE)
117-
* @param string|Expression $dest actual destination
118-
* @param array $columns column list of destination
119-
* @param array $values selected fields
120-
* @param OptionsArray $fieldsOptions options for FIELDS/COLUMNS keyword
121-
* @param bool $fieldsKeyword options for OPTIONS keyword
116+
* @param string|null $type type of destination (may be OUTFILE)
117+
* @param string|Expression|null $dest actual destination
118+
* @param array|null $columns column list of destination
119+
* @param array|null $values selected fields
120+
* @param OptionsArray|null $fieldsOptions options for FIELDS/COLUMNS keyword
121+
* @param bool|null $fieldsKeyword options for OPTIONS keyword
122122
*/
123123
public function __construct(
124124
$type = null,

src/Components/WithKeyword.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ final class WithKeyword extends Component
2424
/** @var ArrayObj[] */
2525
public $columns = [];
2626

27-
/** @var Parser */
27+
/** @var Parser|null */
2828
public $statement;
2929

3030
public function __construct(string $name)

src/Parser.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ class Parser extends Core
338338
/**
339339
* The list of tokens that are parsed.
340340
*
341-
* @var TokensList
341+
* @var TokensList|null
342342
*/
343343
public $list;
344344

@@ -357,8 +357,8 @@ class Parser extends Core
357357
public $brackets = 0;
358358

359359
/**
360-
* @param string|UtfString|TokensList $list the list of tokens to be parsed
361-
* @param bool $strict whether strict mode should be enabled or not
360+
* @param string|UtfString|TokensList|null $list the list of tokens to be parsed
361+
* @param bool $strict whether strict mode should be enabled or not
362362
*/
363363
public function __construct($list = null, $strict = false)
364364
{

src/Statement.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,27 +69,27 @@ abstract class Statement implements Stringable
6969
*
7070
* @see static::$OPTIONS
7171
*
72-
* @var OptionsArray
72+
* @var OptionsArray|null
7373
*/
7474
public $options;
7575

7676
/**
7777
* The index of the first token used in this statement.
7878
*
79-
* @var int
79+
* @var int|null
8080
*/
8181
public $first;
8282

8383
/**
8484
* The index of the last token used in this statement.
8585
*
86-
* @var int
86+
* @var int|null
8787
*/
8888
public $last;
8989

9090
/**
91-
* @param Parser $parser the instance that requests parsing
92-
* @param TokensList $list the list of tokens to be parsed
91+
* @param Parser|null $parser the instance that requests parsing
92+
* @param TokensList|null $list the list of tokens to be parsed
9393
*/
9494
public function __construct(?Parser $parser = null, ?TokensList $list = null)
9595
{

0 commit comments

Comments
 (0)