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
5 changes: 2 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,11 @@
"phpstan/phpstan-webmozart-assert": "^2.0",
"phpunit/phpunit": "^13.2",
"rector/jack": "^1.0",
"rector/rector": "^2.5",
"rector/type-perfect": "^2.1",
"rector/rector": "^2.6",
"symplify/phpstan-rules": "^14.12",
"symplify/vendor-patches": "^11.5",
"tomasvotruba/class-leak": "^2.1.7",
"tomasvotruba/type-coverage": "^2.2",
"tomasvotruba/type-coverage": "^2.3",
"tomasvotruba/unused-public": "^2.2",
"tracy/tracy": "^2.12"
},
Expand Down
2 changes: 1 addition & 1 deletion src/FileSystem/PathNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function normalizePath(string $originalPath): string
$path = $originalPath;
}

$normalizedPath = str_replace('\\', '/', (string) $path);
$normalizedPath = str_replace('\\', '/', $path);
$path = Strings::replace($normalizedPath, self::TWO_AND_MORE_SLASHES_REGEX, '/');

$pathRoot = str_starts_with($path, '/') ? $directorySeparator : '';
Expand Down
6 changes: 3 additions & 3 deletions src/Finder/SourceFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
/**
* @see \Symplify\EasyCodingStandard\Tests\Finder\SourceFinderTest
*/
final class SourceFinder
final readonly class SourceFinder
{
/**
* @var string[]
*/
private array $fileExtensions = [];
private array $fileExtensions;

public function __construct()
{
Expand Down Expand Up @@ -56,7 +56,7 @@ private function processDirectory(string $directory): array
->ignoreDotFiles(false)
->name($normalizedFileExtensions)
->in($directory)
->exclude('vendor')
->exclude(['vendor', 'node_modules'])
// skip empty files
->size('> 0')
->sortByName();
Expand Down
16 changes: 8 additions & 8 deletions src/FixerRunner/Application/FixerFileProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,24 @@
/**
* @see \Symplify\EasyCodingStandard\Tests\Error\ErrorCollector\FixerFileProcessorTest
*/
final class FixerFileProcessor implements FileProcessorInterface
final readonly class FixerFileProcessor implements FileProcessorInterface
{
/**
* @var FixerInterface[]
*/
private array $fixers = [];
private array $fixers;

private readonly bool $isDebug;
private bool $isDebug;

/**
* @param FixerInterface[] $fixers
*/
public function __construct(
private readonly FileToTokensParser $fileToTokensParser,
private readonly Skipper $skipper,
private readonly DifferInterface $differ,
private readonly EasyCodingStandardStyle $easyCodingStandardStyle,
private readonly FileDiffFactory $fileDiffFactory,
private FileToTokensParser $fileToTokensParser,
private Skipper $skipper,
private DifferInterface $differ,
private EasyCodingStandardStyle $easyCodingStandardStyle,
private FileDiffFactory $fileDiffFactory,
array $fixers
) {
$this->fixers = $this->sortFixers($fixers);
Expand Down
4 changes: 2 additions & 2 deletions src/Skipper/Skipper/Skipper.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
* @api
* @see \Symplify\EasyCodingStandard\Tests\Skipper\Skipper\Skipper\SkipperTest
*/
final class Skipper
final readonly class Skipper
{
private const string FILE_ELEMENT = 'file_elements';

/**
* @var SkipVoterInterface[]
*/
private array $skipVoters = [];
private array $skipVoters;

public function __construct(
ClassAndCodeSkipVoter $classAndCodeSkipVoter,
Expand Down
2 changes: 1 addition & 1 deletion src/Testing/PHPUnit/AbstractCheckerTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ protected function doTestFile(string $filePath): void
$expectedContents = $fileContents;
}

$inputFilePath = sys_get_temp_dir() . '/ecs_tests/' . md5((string) $inputContents) . '.php';
$inputFilePath = sys_get_temp_dir() . '/ecs_tests/' . md5($inputContents) . '.php';
FileSystem::write($inputFilePath, $inputContents, null);

// 1. process php-cs-fixer
Expand Down
8 changes: 4 additions & 4 deletions src/ValueObject/Error/ErrorAndDiffResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@

use Symplify\EasyCodingStandard\SniffRunner\ValueObject\Error\CodingStandardError;

final class ErrorAndDiffResult
final readonly class ErrorAndDiffResult
{
/**
* @var CodingStandardError[]
*/
private array $codingStandardErrors = [];
private array $codingStandardErrors;

/**
* @var FileDiff[]
*/
private array $fileDiffs = [];
private array $fileDiffs;

/**
* @param CodingStandardError[] $codingStandardErrors
Expand All @@ -26,7 +26,7 @@ final class ErrorAndDiffResult
public function __construct(
array $codingStandardErrors,
array $fileDiffs,
private readonly array $systemErrors
private array $systemErrors
) {
$this->codingStandardErrors = $this->sortByFileAndLine($codingStandardErrors);
$this->fileDiffs = $this->sortByFilePath($fileDiffs);
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions tests/Finder/SourceFinderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ public function test(): void
$foundFiles = $sourceFinder->find([__DIR__ . '/SourceFinderSource/Source']);
$this->assertCount(2, $foundFiles);

foreach ($foundFiles as $foundFile) {
$this->assertStringNotContainsString('node_modules', $foundFile);
}

$foundFiles = $sourceFinder->find([__DIR__ . '/SourceFinderSource/Source/SomeClass.php.inc']);
$this->assertCount(1, $foundFiles);
}
Expand Down
Loading