Skip to content

Commit 8a2c269

Browse files
authored
[BUGFIX] Make Fractor free from Rector dependencies (#380)
Resolves: #378
1 parent bcd09a2 commit 8a2c269

7 files changed

Lines changed: 17 additions & 19 deletions

File tree

packages/fractor-rule-generator/src/FileSystem/TemplateFileSystem.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
namespace a9f\FractorRuleGenerator\FileSystem;
66

77
use a9f\Fractor\Exception\ShouldNotHappenException;
8+
use a9f\Fractor\Testing\PHPUnit\StaticPHPUnitEnvironment;
89
use a9f\FractorRuleGenerator\Finder\TemplateFinder;
910
use Nette\Utils\Strings;
10-
use Rector\Testing\PHPUnit\StaticPHPUnitEnvironment;
1111
use Symfony\Component\Filesystem\Filesystem;
1212
use Symfony\Component\Finder\SplFileInfo;
1313

packages/fractor/src/Configuration/ConfigurationRuleFilter.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,18 @@ public function filter(iterable $fractorRules): array
4343
}
4444

4545
/**
46-
* @param list<FractorRule> $rectors
46+
* @param list<FractorRule> $fractorRules
4747
* @return list<FractorRule>
4848
*/
49-
public function filterOnlyRule(array $rectors, string $onlyRule): array
49+
public function filterOnlyRule(array $fractorRules, string $onlyRule): array
5050
{
51-
$activeRectors = [];
52-
foreach ($rectors as $rector) {
53-
if ($rector instanceof $onlyRule) {
54-
$activeRectors[] = $rector;
51+
$rules = [];
52+
foreach ($fractorRules as $fractorRule) {
53+
if ($fractorRule instanceof $onlyRule) {
54+
$rules[] = $fractorRule;
5555
}
5656
}
5757

58-
return $activeRectors;
58+
return $rules;
5959
}
6060
}

packages/fractor/src/Helper/FileHasher.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace a9f\Fractor\Helper;
66

7-
use Rector\Exception\ShouldNotHappenException;
7+
use a9f\Fractor\Exception\ShouldNotHappenException;
88

99
final class FileHasher
1010
{

packages/fractor/src/Testing/Fixture/FixtureTempFileDumper.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ final class FixtureTempFileDumper
1515

1616
public static function dump(string $fileContents, string $suffix): string
1717
{
18-
// the "php" suffix is important, because that will hook into \Rector\Application\FileProcessor\PhpFileProcessor
1918
$temporaryFileName = sys_get_temp_dir() . self::TEMP_FIXTURE_DIRECTORY . '/' . md5(
2019
$fileContents
2120
) . '.' . $suffix;

packages/typo3-fractor/bin/typo3-fractor-init.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
declare(strict_types=1);
44

5+
use a9f\Fractor\FileSystem\InitFilePathsResolver;
56
use Nette\Utils\FileSystem;
6-
use Rector\FileSystem\InitFilePathsResolver;
77
use Symfony\Component\Console\Command\Command;
88
use Symfony\Component\Console\Input\InputInterface;
99
use Symfony\Component\Console\Output\OutputInterface;
@@ -38,8 +38,8 @@
3838
return Command::FAILURE;
3939
}
4040

41-
$commonRectorConfigPath = $projectDirectory . '/fractor.php';
42-
if (file_exists($commonRectorConfigPath)) {
41+
$commonFractorConfigPath = $projectDirectory . '/fractor.php';
42+
if (file_exists($commonFractorConfigPath)) {
4343
$output->writeln('Configuration already exists.');
4444
return Command::FAILURE;
4545
}
@@ -76,7 +76,7 @@
7676
$output->writeln(
7777
'<info>The config is added now. Run "fractor process" command to make Fractor do the work!</info>'
7878
);
79-
FileSystem::write($commonRectorConfigPath, $configContents, null);
79+
FileSystem::write($commonFractorConfigPath, $configContents, null);
8080
return Command::SUCCESS;
8181
})
8282
->run();

packages/typo3-fractor/tests/Functional/Bin/InitCommandTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
namespace a9f\Typo3Fractor\Tests\Functional\Bin;
66

7+
use a9f\Fractor\FileSystem\InitFilePathsResolver;
78
use Nette\Utils\FileSystem;
89
use PHPUnit\Framework\TestCase;
9-
use Rector\FileSystem\InitFilePathsResolver;
1010
use Symfony\Component\Console\Command\Command;
1111
use Symfony\Component\Console\Input\InputInterface;
1212
use Symfony\Component\Console\Output\OutputInterface;
@@ -52,8 +52,8 @@ protected function setUp(): void
5252
return Command::FAILURE;
5353
}
5454

55-
$commonRectorConfigPath = $projectDirectory . '/fractor.php';
56-
if (file_exists($commonRectorConfigPath)) {
55+
$commonFractorConfigPath = $projectDirectory . '/fractor.php';
56+
if (file_exists($commonFractorConfigPath)) {
5757
$output->writeln('Configuration already exists.');
5858
return Command::FAILURE;
5959
}
@@ -90,7 +90,7 @@ protected function setUp(): void
9090
$output->writeln(
9191
'<info>The config is added now. Run "fractor process" command to make Fractor do the work!</info>'
9292
);
93-
FileSystem::write($commonRectorConfigPath, $configContents, null);
93+
FileSystem::write($commonFractorConfigPath, $configContents, null);
9494
return Command::SUCCESS;
9595
});
9696

phpstan.neon

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ parameters:
88
paths:
99
- src/
1010
- packages/
11-
- ecs.php
1211
- rector.php
1312
excludePaths:
1413
- packages/extension-installer/generated

0 commit comments

Comments
 (0)