From 7bb73475551de1f57c2ceff38ead35b19539ecd0 Mon Sep 17 00:00:00 2001 From: Anatoliy Melnikov <5785276@gmail.com> Date: Wed, 11 Dec 2024 07:48:09 +0300 Subject: [PATCH 1/3] Move configs of PHPStan --- phpstan-baseline.neon => scripts/phpstan/baseline.neon | 0 phpstan.neon.dist => scripts/phpstan/config.neon | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename phpstan-baseline.neon => scripts/phpstan/baseline.neon (100%) rename phpstan.neon.dist => scripts/phpstan/config.neon (100%) diff --git a/phpstan-baseline.neon b/scripts/phpstan/baseline.neon similarity index 100% rename from phpstan-baseline.neon rename to scripts/phpstan/baseline.neon diff --git a/phpstan.neon.dist b/scripts/phpstan/config.neon similarity index 100% rename from phpstan.neon.dist rename to scripts/phpstan/config.neon From 705c43af37af2a85d836f16bf5ed4f225d46c471 Mon Sep 17 00:00:00 2001 From: Anatoliy Melnikov <5785276@gmail.com> Date: Wed, 11 Dec 2024 07:49:53 +0300 Subject: [PATCH 2/3] Update paths in config of PHPStan --- scripts/phpstan/baseline.neon | 20 ++++++++++---------- scripts/phpstan/config.neon | 8 ++++---- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/scripts/phpstan/baseline.neon b/scripts/phpstan/baseline.neon index ebd3764..9ad7ad6 100644 --- a/scripts/phpstan/baseline.neon +++ b/scripts/phpstan/baseline.neon @@ -4,59 +4,59 @@ parameters: message: '#^Return type of call to method PHPUnit\\Framework\\TestCase\:\:createMock\(\) contains unresolvable type\.$#' identifier: method.unresolvableReturnType count: 2 - path: tests/Unit/BaselineBuilderTest.php + path: ../../tests/Unit/BaselineBuilderTest.php - message: '#^Return type of call to method PHPUnit\\Framework\\TestCase\:\:createMock\(\) contains unresolvable type\.$#' identifier: method.unresolvableReturnType count: 4 - path: tests/Unit/BaselineTransformer/AwareTransformerTest.php + path: ../../tests/Unit/BaselineTransformer/AwareTransformerTest.php - message: '#^Return type of call to method PHPUnit\\Framework\\TestCase\:\:createMock\(\) contains unresolvable type\.$#' identifier: method.unresolvableReturnType count: 2 - path: tests/Unit/ComparatorTest.php + path: ../../tests/Unit/ComparatorTest.php - message: '#^Return type of call to method PHPUnit\\Framework\\TestCase\:\:createMock\(\) contains unresolvable type\.$#' identifier: method.unresolvableReturnType count: 1 - path: tests/Unit/Model/ConsoleTableTest.php + path: ../../tests/Unit/Model/ConsoleTableTest.php - message: '#^Expression "\$coverage\[''any_key''\]" on a separate line does not do anything\.$#' identifier: expr.resultUnused count: 2 - path: tests/Unit/Model/CoverageTest.php + path: ../../tests/Unit/Model/CoverageTest.php - message: '#^Return type of call to method PHPUnit\\Framework\\TestCase\:\:createMock\(\) contains unresolvable type\.$#' identifier: method.unresolvableReturnType count: 2 - path: tests/Unit/Reader/BaselineTransformingReaderTest.php + path: ../../tests/Unit/Reader/BaselineTransformingReaderTest.php - message: '#^Call to function method_exists\(\) with ''PHPUnit\\\\Framework\\\\TestCase'' and ''expectExceptionMess…'' will always evaluate to true\.$#' identifier: function.alreadyNarrowedType count: 1 - path: tests/Unit/UnitTestCase.php + path: ../../tests/Unit/UnitTestCase.php - message: '#^Call to function method_exists\(\) with ''PHPUnit\\\\Framework\\\\TestCase'' and ''expectWarning'' will always evaluate to true\.$#' identifier: function.alreadyNarrowedType count: 1 - path: tests/Unit/UnitTestCase.php + path: ../../tests/Unit/UnitTestCase.php - message: '#^Call to function method_exists\(\) with ''PHPUnit\\\\Framework\\\\TestCase'' and ''expectWarningMessag…'' will always evaluate to true\.$#' identifier: function.alreadyNarrowedType count: 1 - path: tests/Unit/UnitTestCase.php + path: ../../tests/Unit/UnitTestCase.php - message: '#^Parameter \#1 \$json of function json_decode expects string, string\|false given\.$#' identifier: argument.type count: 1 - path: tests/Unit/Writer/BaselineWriterTest.php + path: ../../tests/Unit/Writer/BaselineWriterTest.php diff --git a/scripts/phpstan/config.neon b/scripts/phpstan/config.neon index 74bc0ef..8e9b31f 100644 --- a/scripts/phpstan/config.neon +++ b/scripts/phpstan/config.neon @@ -1,11 +1,11 @@ includes: - - phpstan-baseline.neon + - ../../scripts/phpstan/baseline.neon parameters: level: 7 reportUnmatchedIgnoredErrors: false paths: - - bin - - src - - tests + - ../../bin + - ../../src + - ../../tests From d2d38888aa8d2d279fbbf6e85c22ea03ab809f36 Mon Sep 17 00:00:00 2001 From: Anatoliy Melnikov <5785276@gmail.com> Date: Wed, 11 Dec 2024 07:53:12 +0300 Subject: [PATCH 3/3] Config composer scripts related to PHPStan --- composer.json | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 0b76857..d59a205 100644 --- a/composer.json +++ b/composer.json @@ -46,12 +46,20 @@ "scripts": { "test": [ "@phpunit", - "@phpstan-analise" + "@phpstan" ], "phive-install": "phive install --trust-gpg-keys $(cat .phive/trust-gpg-keys.txt)", "phpunit": "vendor/bin/phpunit", - "phpstan-analise": "vendor/bin/phpstan analyse", - "phpstan-update": "vendor/bin/phpstan analyse --generate-baseline phpstan-baseline.neon", + "phpstan": [ + "@phpstan-clear", + "@phpstan-analyse" + ], + "phpstan-analise": "vendor/bin/phpstan analyse -c scripts/phpstan/config.neon", + "phpstan-baseline": [ + "@phpstan-clear", + "@phpstan-analise --generate-baseline phpstan-baseline.neon" + ], + "phpstan-clear": "vendor/bin/phpstan clear-result-cache -c scripts/phpstan/config.neon", "set_versions": "sh bin/dev/set_composer_versions" }, "suggest": {