From 1b9ff2b6fa90a9c991b6e1d9ab5bd959802bd099 Mon Sep 17 00:00:00 2001 From: Sami Mazouz Date: Fri, 14 Feb 2025 09:59:54 +0100 Subject: [PATCH] fix(phpstan): incompatibility with recent updates --- composer.json | 2 +- php-packages/phpstan/composer.json | 2 +- php-packages/phpstan/larastan-extension.neon | 10 ---------- php-packages/phpstan/phpstan-baseline.neon | 8 ++++---- 4 files changed, 6 insertions(+), 16 deletions(-) diff --git a/composer.json b/composer.json index 9e7216aa6..e999d8b86 100644 --- a/composer.json +++ b/composer.json @@ -171,7 +171,7 @@ "mockery/mockery": "^1.5", "phpunit/phpunit": "^11.0", "phpstan/phpstan": "^1.10.0", - "larastan/larastan": "2.9.12", + "larastan/larastan": "2.9.14", "symfony/var-dumper": "^7.0", "flarum/testing-tests": "*@dev" }, diff --git a/php-packages/phpstan/composer.json b/php-packages/phpstan/composer.json index d235ca84d..226a86c26 100644 --- a/php-packages/phpstan/composer.json +++ b/php-packages/phpstan/composer.json @@ -6,7 +6,7 @@ "require": { "flarum/testing": "^2.0", "phpstan/phpstan": "^1.10.0", - "larastan/larastan": "2.9.12" + "larastan/larastan": "2.9.14" }, "autoload": { "psr-4": { diff --git a/php-packages/phpstan/larastan-extension.neon b/php-packages/phpstan/larastan-extension.neon index 4b050fe57..55c21e2d0 100644 --- a/php-packages/phpstan/larastan-extension.neon +++ b/php-packages/phpstan/larastan-extension.neon @@ -289,11 +289,6 @@ services: tags: - phpstan.broker.dynamicMethodReturnTypeExtension - - - class: Larastan\Larastan\ReturnTypes\EnumerableGenericStaticMethodDynamicMethodReturnTypeExtension - tags: - - phpstan.broker.dynamicMethodReturnTypeExtension - - class: Larastan\Larastan\ReturnTypes\NewModelQueryDynamicMethodReturnTypeExtension tags: @@ -304,11 +299,6 @@ services: tags: - phpstan.broker.dynamicMethodReturnTypeExtension - - - class: Larastan\Larastan\ReturnTypes\EnumerableGenericStaticMethodDynamicStaticMethodReturnTypeExtension - tags: - - phpstan.broker.dynamicStaticMethodReturnTypeExtension - - class: Larastan\Larastan\Types\AbortIfFunctionTypeSpecifyingExtension tags: diff --git a/php-packages/phpstan/phpstan-baseline.neon b/php-packages/phpstan/phpstan-baseline.neon index 7b618321f..b95ae01da 100644 --- a/php-packages/phpstan/phpstan-baseline.neon +++ b/php-packages/phpstan/phpstan-baseline.neon @@ -15,12 +15,12 @@ parameters: reportUnmatched: false # We ignore this because resolve can either take a class name as the generic return type or just a binding name. - - message: "#Template type T of function resolve[()]{2} is not referenced in a parameter.#" + - message: "#Template type T of function resolve[\\(\\)]{2} is not referenced in a parameter.#" reportUnmatched: false # We ignore new static errors because we want extensibility. # @TODO: needs discussion. - - message: "#^Unsafe usage of new static[()]{2}.$#" + - message: "#^Unsafe usage of new static[\\(\\)]{2}.$#" reportUnmatched: false - message: "#^Static access to instance property .*#" reportUnmatched: false @@ -34,11 +34,11 @@ parameters: # and the implementation only accepts two of them, PHPStan complains. # At the time of adding this error, there are no configuration values to make it # ignore this error, so we have to ignore it globally. - - message: '#^Parameter \#[0-9]+ \$[A-z0-9_]+ of method Flarum\Extend\[A-z0-9_:\\()]+ expects \(?callable\([A-z0-9_,|\\: ()-]+\)\)?, (callable|Closure)\([A-z0-9_,|\\: ()-]+\) given\.$#' + - message: '#^Parameter \#[0-9]+ \$[A-z0-9_]+ of method Flarum\Extend\[A-z0-9_:\\\\(\\)]+ expects \(?callable\([A-z0-9_,|\\: \\(\\)-]+\)\)?, (callable|Closure)\([A-z0-9_,|\\: \\(\\)-]+\) given\.$#' reportUnmatched: false # PHPStan suddenly doesn't recognize callables can be function names? - - message: '#^Parameter \#[0-9]+ \$[A-z0-9_]+ of function [A-z0-9_:\\()]+ expects \(?callable\([A-z0-9_,|\\: ()-]+, ''[A-z0-9_:\\()]+'' given\.$#' + - message: '#^Parameter \#[0-9]+ \$[A-z0-9_]+ of function [A-z0-9_:\\\\(\\)]+ expects \(?callable\([A-z0-9_,|\\: \\(\\)-]+, ''[A-z0-9_:\\\\(\\)]+'' given\.$#' reportUnmatched: false # Not if we're using our own static make method.