Skip to content

Commit 74dee0d

Browse files
committed
Fix running phpstan with newer PHP versions (e.g. 8.4)
phpstan 1.8 cannot run properly with PHP 8.4, but newer versions in the 1.x branch do, thus we change the requirement to phpstan ^1.9, to allow version up to 2.0 (excluding). Newer phpstan versions now detect common errors in regexes: Ignored error #Template type T of function resolve[()]{2} is not referenced in a parameter.# has an unescaped '()' which leads to ignoring all errors. Use '\(\)' instead. Ignored error #^Unsafe usage of new static[()]{2}.$# has an unescaped '()' which leads to ignoring all errors. Use '\(\)' instead. So these regexes are also fixed by using non-evaluated string litterals and escaping the parenthesis as recommended instead of using a weird trick with the brackets.
1 parent 29da25d commit 74dee0d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

php-packages/phpstan/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"minimum-stability": "dev",
55
"license": "MIT",
66
"require": {
7-
"phpstan/phpstan": ">=1.8.11 < 1.9.0",
7+
"phpstan/phpstan": "^1.9",
88
"nunomaduro/larastan": "^1.0"
99
},
1010
"autoload": {

php-packages/phpstan/phpstan-baseline.neon

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ parameters:
99
reportUnmatched: false
1010

1111
# We ignore this because resolve can either take a class name as the generic return type or just a binding name.
12-
- message: "#Template type T of function resolve[()]{2} is not referenced in a parameter.#"
12+
- message: '#Template type T of function resolve\(\) is not referenced in a parameter.#'
1313
reportUnmatched: false
1414

1515
# We ignore new static errors because we want extensibility.
1616
# @TODO: needs discussion.
17-
- message: "#^Unsafe usage of new static[()]{2}.$#"
17+
- message: '#^Unsafe usage of new static\(\).$#'
1818
reportUnmatched: false
1919

2020
# ConnectionInterface lacks methods that exist in the implementation,

0 commit comments

Comments
 (0)