Skip to content

Commit 573cc98

Browse files
authored
[TASK] Configure the target PHP version for PHPStan (#1400)
This will help avoid it suggesting things that are only possile in later PHP versions.
1 parent 51c6239 commit 573cc98

File tree

2 files changed

+36
-4
lines changed

2 files changed

+36
-4
lines changed

config/phpstan-baseline.neon

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ parameters:
6060
count: 1
6161
path: ../src/HtmlProcessor/CssToAttributeConverter.php
6262

63+
-
64+
message: '#^PHPDoc tag @var with type array\<int, string\> is not subtype of native type list\<string\>\|false\.$#'
65+
identifier: varTag.nativeType
66+
count: 1
67+
path: ../src/HtmlProcessor/CssToAttributeConverter.php
68+
6369
-
6470
message: '#^Argument of an invalid type DOMNodeList\<DOMNode\>\|false supplied for foreach, only iterables are supported\.$#'
6571
identifier: foreach.nonIterable
@@ -144,6 +150,12 @@ parameters:
144150
count: 1
145151
path: ../src/Utilities/Preg.php
146152

153+
-
154+
message: '#^Method Pelago\\Emogrifier\\Utilities\\Preg\:\:matchAll\(\) should return int but returns int\<0, max\>\|null\.$#'
155+
identifier: return.type
156+
count: 1
157+
path: ../src/Utilities/Preg.php
158+
147159
-
148160
message: '#^Method Pelago\\Emogrifier\\Utilities\\Preg\:\:replace\(\) never assigns null to &\$count so it can be removed from the by\-ref type\.$#'
149161
identifier: parameterByRef.unusedType
@@ -157,7 +169,7 @@ parameters:
157169
path: ../src/Utilities/Preg.php
158170

159171
-
160-
message: '#^Parameter \#1 \$array of function array_flip expects array\<int\|string\>, array\<string, mixed\> given\.$#'
172+
message: '#^Parameter \#1 \$input of function array_flip expects array\<int\|string\>, array\<string, mixed\> given\.$#'
161173
identifier: argument.type
162174
count: 1
163175
path: ../src/Utilities/Preg.php
@@ -207,13 +219,13 @@ parameters:
207219
path: ../tests/Unit/Css/CssDocumentTest.php
208220

209221
-
210-
message: '#^Parameter \#1 \$string of function trim expects string, string\|false given\.$#'
222+
message: '#^Parameter \#1 \$str of function trim expects string, string\|false given\.$#'
211223
identifier: argument.type
212224
count: 1
213225
path: ../tests/Unit/CssInlinerTest.php
214226

215227
-
216-
message: '#^Parameter \#1 \$string of function strtolower expects string, string\|false given\.$#'
228+
message: '#^Parameter \#1 \$str of function strtolower expects string, string\|false given\.$#'
217229
identifier: argument.type
218230
count: 1
219231
path: ../tests/Unit/HtmlProcessor/AbstractHtmlProcessorTest.php
@@ -231,7 +243,25 @@ parameters:
231243
path: ../tests/Unit/HtmlProcessor/HtmlPrunerTest.php
232244

233245
-
234-
message: '#^Parameter \#1 \$array of function array_filter expects array, array\<int, array\<int, string\>\>\|null given\.$#'
246+
message: '#^Method Pelago\\Emogrifier\\Tests\\Unit\\Support\\Constraint\\IsEquivalentCssTest\:\:arrayMapKeys\(\) should return array\<string, T\> but returns array\<string, T\>\|false\.$#'
247+
identifier: return.type
248+
count: 1
249+
path: ../tests/Unit/Support/Constraint/IsEquivalentCssTest.php
250+
251+
-
252+
message: '#^Method Pelago\\Emogrifier\\Tests\\Unit\\Support\\Constraint\\StringContainsCssCountTest\:\:arrayMapKeys\(\) should return array\<string, T\> but returns array\<string, T\>\|false\.$#'
253+
identifier: return.type
254+
count: 1
255+
path: ../tests/Unit/Support/Constraint/StringContainsCssCountTest.php
256+
257+
-
258+
message: '#^Method Pelago\\Emogrifier\\Tests\\Unit\\Support\\Constraint\\StringContainsCssTest\:\:arrayMapKeys\(\) should return array\<string, T\> but returns array\<string, T\>\|false\.$#'
259+
identifier: return.type
260+
count: 1
261+
path: ../tests/Unit/Support/Constraint/StringContainsCssTest.php
262+
263+
-
264+
message: '#^Parameter \#1 \$input of function array_filter expects array, array\<int, array\<int, string\>\>\|null given\.$#'
235265
identifier: argument.type
236266
count: 1
237267
path: ../tests/Unit/Utilities/PregTest.php

config/phpstan.neon

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ includes:
22
- phpstan-baseline.neon
33

44
parameters:
5+
phpVersion: 70300
6+
57
level: 10
68

79
paths:

0 commit comments

Comments
 (0)