From 1599183bc8dcc9880baf56de859c2f0058bcf98d Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Wed, 16 Aug 2023 13:05:58 +0200 Subject: [PATCH 1/2] bump deps --- .gitattributes | 3 +-- .github/workflows/code_analysis.yaml | 2 +- composer.json | 14 +++++++------- easy-ci.php | 14 -------------- ecs.php | 1 - phpstan.neon | 5 ----- 6 files changed, 9 insertions(+), 30 deletions(-) delete mode 100644 easy-ci.php diff --git a/.gitattributes b/.gitattributes index 222e4c5e..10a63c8d 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,7 +3,6 @@ phpunit.xml export-ignore *.md export-ignore /tests export-ignore -/easy-ci.php export-ignore /ecs.php export-ignore /phpstan.neon export-ignore -/rector.php export-ignore \ No newline at end of file +/rector.php export-ignore diff --git a/.github/workflows/code_analysis.yaml b/.github/workflows/code_analysis.yaml index 55c4b3b9..2cf0c8ed 100644 --- a/.github/workflows/code_analysis.yaml +++ b/.github/workflows/code_analysis.yaml @@ -46,7 +46,7 @@ jobs: - name: 'Check Active Classes' - run: vendor/bin/easy-ci check-active-class src --ansi + run: vendor/bin/class-leak check src --ansi name: ${{ matrix.actions.name }} runs-on: ubuntu-latest diff --git a/composer.json b/composer.json index 4ee3cc60..a4fa47de 100644 --- a/composer.json +++ b/composer.json @@ -5,20 +5,20 @@ "license": "MIT", "require": { "php": ">=8.1", - "phpstan/phpstan": "^1.9.7", + "phpstan/phpstan": "^1.10", "symfony/filesystem": "^6.2" }, "require-dev": { "php-parallel-lint/php-parallel-lint": "^1.3", "phpstan/extension-installer": "^1.2", - "phpunit/phpunit": "^10.0", - "rector/rector": "^0.15.13", + "phpunit/phpunit": "^10.3", + "rector/rector": "^0.17", "symfony/dependency-injection": "^6.2", "symfony/finder": "^6.2", - "symplify/easy-ci": "^11.2", - "symplify/easy-coding-standard": "^11.2", - "symplify/phpstan-rules": "^11.2", - "tomasvotruba/unused-public": "^0.0.34", + "symplify/easy-coding-standard": "^12.0", + "symplify/phpstan-rules": "^12.0", + "tomasvotruba/class-leak": "0.1.1.72", + "tomasvotruba/unused-public": "^0.3", "tracy/tracy": "^2.9" }, "autoload": { diff --git a/easy-ci.php b/easy-ci.php deleted file mode 100644 index f04d3cb6..00000000 --- a/easy-ci.php +++ /dev/null @@ -1,14 +0,0 @@ -typesToSkip([ - DynamicFunctionReturnTypeExtension::class, - DynamicMethodReturnTypeExtension::class, - ]); -}; diff --git a/ecs.php b/ecs.php index bb42212e..862b15d4 100644 --- a/ecs.php +++ b/ecs.php @@ -9,7 +9,6 @@ $ecsConfig->paths([ __DIR__ . '/ecs.php', __DIR__ . '/rector.php', - __DIR__ . '/easy-ci.php', __DIR__ . '/src', __DIR__ . '/tests', ]); diff --git a/phpstan.neon b/phpstan.neon index c940197e..7653195d 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -15,11 +15,6 @@ parameters: # copy-pasted 3rd party code - src/Console/Terminal.php - unused_public: - methods: true - properties: true - constants: true - ignoreErrors: - '#Calling PHPStan\\Testing\\ErrorFormatterTestCase\:\:(getOutputContent|getOutput|getAnalysisResult)|\(\) is not covered by backward compatibility promise\. The method might change in a minor PHPStan version#' - '#Extending PHPStan\\Testing\\ErrorFormatterTestCase is not covered by backward compatibility promise\. The class might change in a minor PHPStan version#' From 4cb66442bda01ca44575fe636948d815c85faab5 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Wed, 16 Aug 2023 13:12:28 +0200 Subject: [PATCH 2/2] add FilesystemHelper --- composer.json | 4 ++-- src/ErrorFormatter/SymplifyErrorFormatter.php | 11 ++++------- src/FilesystemHelper.php | 17 +++++++++++++++++ 3 files changed, 23 insertions(+), 9 deletions(-) create mode 100644 src/FilesystemHelper.php diff --git a/composer.json b/composer.json index a4fa47de..9e2efdc3 100644 --- a/composer.json +++ b/composer.json @@ -5,8 +5,7 @@ "license": "MIT", "require": { "php": ">=8.1", - "phpstan/phpstan": "^1.10", - "symfony/filesystem": "^6.2" + "phpstan/phpstan": "^1.10" }, "require-dev": { "php-parallel-lint/php-parallel-lint": "^1.3", @@ -15,6 +14,7 @@ "rector/rector": "^0.17", "symfony/dependency-injection": "^6.2", "symfony/finder": "^6.2", + "symplify/easy-ci": "11.3.1.72", "symplify/easy-coding-standard": "^12.0", "symplify/phpstan-rules": "^12.0", "tomasvotruba/class-leak": "0.1.1.72", diff --git a/src/ErrorFormatter/SymplifyErrorFormatter.php b/src/ErrorFormatter/SymplifyErrorFormatter.php index d7bc0520..d398c3b7 100644 --- a/src/ErrorFormatter/SymplifyErrorFormatter.php +++ b/src/ErrorFormatter/SymplifyErrorFormatter.php @@ -10,9 +10,9 @@ use PHPStan\Command\ErrorFormatter\ErrorFormatter; use PHPStan\Command\Output; use PHPStan\Command\OutputStyle; -use Symfony\Component\Filesystem\Filesystem; use Symplify\PHPStanExtensions\Console\Terminal; use Symplify\PHPStanExtensions\Enum\ResultStatus; +use Symplify\PHPStanExtensions\FilesystemHelper; /** * @see \Symplify\PHPStanExtensions\Tests\ErrorFormatter\SymplifyErrorFormatterTest @@ -68,8 +68,8 @@ private function reportErrors(AnalysisResult $analysisResult, OutputStyle $outpu return; } - foreach ($analysisResult->getFileSpecificErrors() as $error) { - $this->printSingleError($error, $outputStyle); + foreach ($analysisResult->getFileSpecificErrors() as $fileSpecificError) { + $this->printSingleError($fileSpecificError, $outputStyle); } $outputStyle->newLine(); @@ -92,10 +92,7 @@ private function getRelativePath(string $filePath): string return $clearFilePath; } - $filesystem = new Filesystem(); - $relativeFilePath = $filesystem->makePathRelative($clearFilePath, getcwd()); - - return rtrim($relativeFilePath, '/'); + return FilesystemHelper::resolveFromCwd($clearFilePath); } private function regexMessage(string $message): string diff --git a/src/FilesystemHelper.php b/src/FilesystemHelper.php new file mode 100644 index 00000000..b0de4207 --- /dev/null +++ b/src/FilesystemHelper.php @@ -0,0 +1,17 @@ +