Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -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
/rector.php export-ignore
2 changes: 1 addition & 1 deletion .github/workflows/code_analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@
"license": "MIT",
"require": {
"php": ">=8.1",
"phpstan/phpstan": "^1.9.7",
"symfony/filesystem": "^6.2"
"phpstan/phpstan": "^1.10"
},
"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-ci": "11.3.1.72",
"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": {
Expand Down
14 changes: 0 additions & 14 deletions easy-ci.php

This file was deleted.

1 change: 0 additions & 1 deletion ecs.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
$ecsConfig->paths([
__DIR__ . '/ecs.php',
__DIR__ . '/rector.php',
__DIR__ . '/easy-ci.php',
__DIR__ . '/src',
__DIR__ . '/tests',
]);
Expand Down
5 changes: 0 additions & 5 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -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#'
Expand Down
11 changes: 4 additions & 7 deletions src/ErrorFormatter/SymplifyErrorFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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();
Expand All @@ -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
Expand Down
17 changes: 17 additions & 0 deletions src/FilesystemHelper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

declare(strict_types=1);

namespace Symplify\PHPStanExtensions;

final class FilesystemHelper
{
public static function resolveFromCwd(string $filePath): string
{
// make path relative with native PHP
$realPath = (string) realpath($filePath);
$relativeFilePath = str_replace(getcwd() . DIRECTORY_SEPARATOR, '', $realPath);

return rtrim($relativeFilePath, '/');
}
}