Skip to content

Commit 3516ef8

Browse files
authored
Bump deps + remove symfony/filesystem dependency to ease installing (#4)
1 parent 235fd35 commit 3516ef8

8 files changed

Lines changed: 31 additions & 38 deletions

File tree

.gitattributes

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
phpunit.xml export-ignore
44
*.md export-ignore
55
/tests export-ignore
6-
/easy-ci.php export-ignore
76
/ecs.php export-ignore
87
/phpstan.neon export-ignore
9-
/rector.php export-ignore
8+
/rector.php export-ignore

.github/workflows/code_analysis.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646

4747
-
4848
name: 'Check Active Classes'
49-
run: vendor/bin/easy-ci check-active-class src --ansi
49+
run: vendor/bin/class-leak check src --ansi
5050

5151
name: ${{ matrix.actions.name }}
5252
runs-on: ubuntu-latest

composer.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@
55
"license": "MIT",
66
"require": {
77
"php": ">=8.1",
8-
"phpstan/phpstan": "^1.9.7",
9-
"symfony/filesystem": "^6.2"
8+
"phpstan/phpstan": "^1.10"
109
},
1110
"require-dev": {
1211
"php-parallel-lint/php-parallel-lint": "^1.3",
1312
"phpstan/extension-installer": "^1.2",
14-
"phpunit/phpunit": "^10.0",
15-
"rector/rector": "^0.15.13",
13+
"phpunit/phpunit": "^10.3",
14+
"rector/rector": "^0.17",
1615
"symfony/dependency-injection": "^6.2",
1716
"symfony/finder": "^6.2",
18-
"symplify/easy-ci": "^11.2",
19-
"symplify/easy-coding-standard": "^11.2",
20-
"symplify/phpstan-rules": "^11.2",
21-
"tomasvotruba/unused-public": "^0.0.34",
17+
"symplify/easy-ci": "11.3.1.72",
18+
"symplify/easy-coding-standard": "^12.0",
19+
"symplify/phpstan-rules": "^12.0",
20+
"tomasvotruba/class-leak": "0.1.1.72",
21+
"tomasvotruba/unused-public": "^0.3",
2222
"tracy/tracy": "^2.9"
2323
},
2424
"autoload": {

easy-ci.php

Lines changed: 0 additions & 14 deletions
This file was deleted.

ecs.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
$ecsConfig->paths([
1010
__DIR__ . '/ecs.php',
1111
__DIR__ . '/rector.php',
12-
__DIR__ . '/easy-ci.php',
1312
__DIR__ . '/src',
1413
__DIR__ . '/tests',
1514
]);

phpstan.neon

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,6 @@ parameters:
1515
# copy-pasted 3rd party code
1616
- src/Console/Terminal.php
1717

18-
unused_public:
19-
methods: true
20-
properties: true
21-
constants: true
22-
2318
ignoreErrors:
2419
- '#Calling PHPStan\\Testing\\ErrorFormatterTestCase\:\:(getOutputContent|getOutput|getAnalysisResult)|\(\) is not covered by backward compatibility promise\. The method might change in a minor PHPStan version#'
2520
- '#Extending PHPStan\\Testing\\ErrorFormatterTestCase is not covered by backward compatibility promise\. The class might change in a minor PHPStan version#'

src/ErrorFormatter/SymplifyErrorFormatter.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
use PHPStan\Command\ErrorFormatter\ErrorFormatter;
1111
use PHPStan\Command\Output;
1212
use PHPStan\Command\OutputStyle;
13-
use Symfony\Component\Filesystem\Filesystem;
1413
use Symplify\PHPStanExtensions\Console\Terminal;
1514
use Symplify\PHPStanExtensions\Enum\ResultStatus;
15+
use Symplify\PHPStanExtensions\FilesystemHelper;
1616

1717
/**
1818
* @see \Symplify\PHPStanExtensions\Tests\ErrorFormatter\SymplifyErrorFormatterTest
@@ -68,8 +68,8 @@ private function reportErrors(AnalysisResult $analysisResult, OutputStyle $outpu
6868
return;
6969
}
7070

71-
foreach ($analysisResult->getFileSpecificErrors() as $error) {
72-
$this->printSingleError($error, $outputStyle);
71+
foreach ($analysisResult->getFileSpecificErrors() as $fileSpecificError) {
72+
$this->printSingleError($fileSpecificError, $outputStyle);
7373
}
7474

7575
$outputStyle->newLine();
@@ -92,10 +92,7 @@ private function getRelativePath(string $filePath): string
9292
return $clearFilePath;
9393
}
9494

95-
$filesystem = new Filesystem();
96-
$relativeFilePath = $filesystem->makePathRelative($clearFilePath, getcwd());
97-
98-
return rtrim($relativeFilePath, '/');
95+
return FilesystemHelper::resolveFromCwd($clearFilePath);
9996
}
10097

10198
private function regexMessage(string $message): string

src/FilesystemHelper.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Symplify\PHPStanExtensions;
6+
7+
final class FilesystemHelper
8+
{
9+
public static function resolveFromCwd(string $filePath): string
10+
{
11+
// make path relative with native PHP
12+
$realPath = (string) realpath($filePath);
13+
$relativeFilePath = str_replace(getcwd() . DIRECTORY_SEPARATOR, '', $realPath);
14+
15+
return rtrim($relativeFilePath, '/');
16+
}
17+
}

0 commit comments

Comments
 (0)