Skip to content

Commit

Permalink
Remove tweak require symplify/smart-file-system (#3882)
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed May 17, 2023
1 parent 41aabcb commit ae78ef1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
"symfony/string": "^6.2.2",
"symplify/easy-parallel": "^11.1",
"symplify/rule-doc-generator-contracts": "^11.1",
"symplify/smart-file-system": "^11.2",
"tracy/tracy": "^2.9",
"webmozart/assert": "^1.11"
},
Expand Down
10 changes: 5 additions & 5 deletions src/Kernel/CachedContainerBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Dumper\PhpDumper;
use Symplify\SmartFileSystem\SmartFileSystem;
use Symfony\Component\Filesystem\Filesystem;

/**
* see https://symfony.com/doc/current/components/dependency_injection/compilation.html#dumping-the-configuration-for-performance
Expand All @@ -30,7 +30,7 @@ public function __construct(
*/
public function build(array $configFiles, string $hash, callable $containerBuilderCallback): ContainerInterface
{
$smartFileSystem = new SmartFileSystem();
$filesystem = new Filesystem();
$className = 'RectorKernel' . $hash;
$file = $this->cacheDir . 'kernel-' . $this->cacheKey . '-' . $hash . '.php';

Expand All @@ -55,7 +55,7 @@ public function build(array $configFiles, string $hash, callable $containerBuild
throw new ShouldNotHappenException();
}

$smartFileSystem->dumpFile($file, $dumpedContainer);
$filesystem->dumpFile($file, $dumpedContainer);
}

return $container;
Expand All @@ -72,7 +72,7 @@ public function clearCache(): void
return;
}

$smartFileSystem = new SmartFileSystem();
$smartFileSystem->remove($cacheFiles);
$filesystem = new Filesystem();
$filesystem->remove($cacheFiles);
}
}
10 changes: 5 additions & 5 deletions tests/Util/FileHasherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@

use Rector\Core\Util\FileHasher;
use Rector\Testing\PHPUnit\AbstractTestCase;
use Symplify\SmartFileSystem\SmartFileSystem;
use Symfony\Component\Filesystem\Filesystem;

final class FileHasherTest extends AbstractTestCase
{
private FileHasher $fileHasher;

private SmartFileSystem $smartFileSystem;
private Filesystem $filesystem;

protected function setUp(): void
{
$this->boot();

$this->fileHasher = $this->getService(FileHasher::class);
$this->smartFileSystem = new SmartFileSystem();
$this->filesystem = new Filesystem();
}

public function testHash(): void
Expand All @@ -34,12 +34,12 @@ public function testHashFiles(): void
$file = $dir . '/FileHasherTest-fixture.txt';

try {
$this->smartFileSystem->dumpFile($file, 'some string');
$this->filesystem->dumpFile($file, 'some string');

$hash = $this->fileHasher->hashFiles([$file]);
$this->assertSame('8df638f91bacc826bf50c04efd7df1b1', $hash);
} finally {
$this->smartFileSystem->remove($file);
$this->filesystem->remove($file);
}
}

Expand Down

0 comments on commit ae78ef1

Please sign in to comment.