Skip to content

Commit

Permalink
enable symlinks by default
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Apr 20, 2022
1 parent 187fd3f commit 94af16d
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 27 deletions.
1 change: 1 addition & 0 deletions src/Configuration/Option.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ final class Option
public const PARALLEL_TIMEOUT_IN_SECONDS = 'parallel-timeout-in-seconds';

/**
* @deprecated Symlinks are enabled by default.
* @var string
*/
public const FOLLOW_SYMLINKS = 'follow-symlinks';
Expand Down
7 changes: 2 additions & 5 deletions src/FileSystem/FilesFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,8 @@ private function findInDirectories(array $directories, array $suffixes): array
// skip empty files
->size('> 0')
->in($directories)
->sortByName();

if ($this->hasFollowLinks()) {
$finder->followLinks();
}
->sortByName()
->followLinks();

if ($suffixes !== []) {
$suffixesPattern = $this->normalizeSuffixesToPattern($suffixes);
Expand Down
8 changes: 0 additions & 8 deletions tests/FileSystem/FilesFinder/FilesFinderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,6 @@ protected function setUp(): void
$this->filesFinder = $this->getService(FilesFinder::class);
}

public function testWithoutFollowingSymlinks(): void
{
$this->bootFromConfigFiles([__DIR__ . '/config/disable_follow_symlinks.php']);
$filesFinder = $this->getService(FilesFinder::class);
$foundFiles = $filesFinder->findInDirectoriesAndFiles([__DIR__ . '/SourceWithSymlinks'], ['txt']);
$this->assertCount(1, $foundFiles);
}

public function testWithFollowingSymlinks(): void
{
$this->bootFromConfigFiles([__DIR__ . '/config/enable_follow_symlinks.php']);
Expand Down
11 changes: 0 additions & 11 deletions tests/FileSystem/FilesFinder/config/disable_follow_symlinks.php

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
declare(strict_types=1);

use Rector\Config\RectorConfig;
use Rector\Core\Configuration\Option;

return static function (RectorConfig $rectorConfig): void {
$parameters = $rectorConfig->parameters();
$parameters->set(Option::FOLLOW_SYMLINKS, true);
};

0 comments on commit 94af16d

Please sign in to comment.