From 11ce9728e12831d793925d04fe3775c30a156dbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mor=C3=A1vek?= Date: Sat, 4 Nov 2023 12:55:03 +0100 Subject: [PATCH 1/2] Fix build against latest PHPStan --- .github/dependabot.yml | 1 + composer.json | 4 +++- phpstan.tests.neon.dist | 1 + .../CatchWithUnthrownExceptionRuleTest.php | 12 +++++++++++- tests/PHPStan/conditional.config.tests.php | 17 +++++++++++++++++ 5 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 tests/PHPStan/conditional.config.tests.php diff --git a/.github/dependabot.yml b/.github/dependabot.yml index ac5420e..4ea27ae 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -14,6 +14,7 @@ updates: - dependency-type: "development" ignore: - dependency-name: "phpunit/phpunit" + - dependency-name: "composer-runtime-api" groups: phpstan: patterns: ["*phpstan*"] diff --git a/composer.json b/composer.json index 1b90439..887c459 100644 --- a/composer.json +++ b/composer.json @@ -30,7 +30,9 @@ "shipmonk/phpstan-rules": "2.7.0", "phpstan/phpstan-phpunit": "1.3.14", "php-parallel-lint/php-parallel-lint": "1.3.2", - "nepada/coding-standard": "7.11.0" + "nepada/coding-standard": "7.11.0", + "composer-runtime-api": "^2.0", + "composer/semver": "3.4.0" }, "autoload": { "psr-4": { diff --git a/phpstan.tests.neon.dist b/phpstan.tests.neon.dist index 54f63a2..1f7ced2 100644 --- a/phpstan.tests.neon.dist +++ b/phpstan.tests.neon.dist @@ -9,6 +9,7 @@ includes: - vendor/spaze/phpstan-disallowed-calls/disallowed-loose-calls.neon - tests/PHPStan/disallowedCalls.neon - tests/PHPStan/shipmonk.neon + - tests/PHPStan/conditional.config.tests.php parameters: level: max diff --git a/tests/MessageBus/CatchWithUnthrownExceptionRuleTest.php b/tests/MessageBus/CatchWithUnthrownExceptionRuleTest.php index f589e8b..2390b2b 100644 --- a/tests/MessageBus/CatchWithUnthrownExceptionRuleTest.php +++ b/tests/MessageBus/CatchWithUnthrownExceptionRuleTest.php @@ -4,6 +4,7 @@ namespace NepadaTests\PHPStan\MessageBus; use PHPStan\Rules\Exceptions\CatchWithUnthrownExceptionRule; +use PHPStan\Rules\Exceptions\DefaultExceptionTypeResolver; use PHPStan\Rules\Rule; /** @@ -14,7 +15,16 @@ class CatchWithUnthrownExceptionRuleTest extends DynamicExtensionsRuleTestCase protected function getRule(): Rule { - return new CatchWithUnthrownExceptionRule(); + return new CatchWithUnthrownExceptionRule( + new DefaultExceptionTypeResolver( + $this->createReflectionProvider(), + [], + [], + [], + [], + ), + true + ); } public function testRule(): void diff --git a/tests/PHPStan/conditional.config.tests.php b/tests/PHPStan/conditional.config.tests.php new file mode 100644 index 0000000..450c91e --- /dev/null +++ b/tests/PHPStan/conditional.config.tests.php @@ -0,0 +1,17 @@ + '~^Class PHPStan\\\\Rules\\\\Exceptions\\\\CatchWithUnthrownExceptionRule does not have a constructor and must be instantiated without any parameters\\.$~', + 'path' => '../../tests/MessageBus/CatchWithUnthrownExceptionRuleTest.php', + 'count' => 1, + ]; +} + +return $config; From bbdb9ade4d9c700e4f87505fb38ee40d694041f4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 4 Nov 2023 11:55:31 +0000 Subject: [PATCH 2/2] Bump the phpstan group with 4 updates Updates the requirements on [phpstan/phpstan-strict-rules](https://github.com/phpstan/phpstan-strict-rules), [spaze/phpstan-disallowed-calls](https://github.com/spaze/phpstan-disallowed-calls), [shipmonk/phpstan-rules](https://github.com/shipmonk-rnd/phpstan-rules) and [phpstan/phpstan-phpunit](https://github.com/phpstan/phpstan-phpunit) to permit the latest version. Updates `phpstan/phpstan-strict-rules` to 1.5.2 - [Release notes](https://github.com/phpstan/phpstan-strict-rules/releases) - [Commits](https://github.com/phpstan/phpstan-strict-rules/compare/1.5.1...1.5.2) Updates `spaze/phpstan-disallowed-calls` to 2.16.1 - [Release notes](https://github.com/spaze/phpstan-disallowed-calls/releases) - [Commits](https://github.com/spaze/phpstan-disallowed-calls/compare/v2.16.0...v2.16.1) Updates `shipmonk/phpstan-rules` to 2.9.2 - [Release notes](https://github.com/shipmonk-rnd/phpstan-rules/releases) - [Commits](https://github.com/shipmonk-rnd/phpstan-rules/compare/2.7.0...2.9.2) Updates `phpstan/phpstan-phpunit` to 1.3.15 - [Release notes](https://github.com/phpstan/phpstan-phpunit/releases) - [Commits](https://github.com/phpstan/phpstan-phpunit/compare/1.3.14...1.3.15) --- updated-dependencies: - dependency-name: phpstan/phpstan-strict-rules dependency-type: direct:development dependency-group: phpstan - dependency-name: spaze/phpstan-disallowed-calls dependency-type: direct:development dependency-group: phpstan - dependency-name: shipmonk/phpstan-rules dependency-type: direct:development dependency-group: phpstan - dependency-name: phpstan/phpstan-phpunit dependency-type: direct:development dependency-group: phpstan ... Signed-off-by: dependabot[bot] --- composer.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 887c459..dc7a1b9 100644 --- a/composer.json +++ b/composer.json @@ -25,10 +25,10 @@ }, "require-dev": { "phpunit/phpunit": "^8.5.21 || ^9.5.10", - "phpstan/phpstan-strict-rules": "1.5.1", - "spaze/phpstan-disallowed-calls": "2.16.0", - "shipmonk/phpstan-rules": "2.7.0", - "phpstan/phpstan-phpunit": "1.3.14", + "phpstan/phpstan-strict-rules": "1.5.2", + "spaze/phpstan-disallowed-calls": "2.16.1", + "shipmonk/phpstan-rules": "2.9.2", + "phpstan/phpstan-phpunit": "1.3.15", "php-parallel-lint/php-parallel-lint": "1.3.2", "nepada/coding-standard": "7.11.0", "composer-runtime-api": "^2.0",