From ae78ef15d1d27bd5f9df02457d02a0fb7d7c3c20 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Wed, 17 May 2023 22:34:25 +0700 Subject: [PATCH] Remove tweak require symplify/smart-file-system (#3882) --- composer.json | 1 - src/Kernel/CachedContainerBuilder.php | 10 +++++----- tests/Util/FileHasherTest.php | 10 +++++----- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/composer.json b/composer.json index aa814371397..0a4f8f96b5c 100644 --- a/composer.json +++ b/composer.json @@ -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" }, diff --git a/src/Kernel/CachedContainerBuilder.php b/src/Kernel/CachedContainerBuilder.php index f0506c8312b..b9a97b729d5 100644 --- a/src/Kernel/CachedContainerBuilder.php +++ b/src/Kernel/CachedContainerBuilder.php @@ -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 @@ -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'; @@ -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; @@ -72,7 +72,7 @@ public function clearCache(): void return; } - $smartFileSystem = new SmartFileSystem(); - $smartFileSystem->remove($cacheFiles); + $filesystem = new Filesystem(); + $filesystem->remove($cacheFiles); } } diff --git a/tests/Util/FileHasherTest.php b/tests/Util/FileHasherTest.php index 0879d9e3510..0fead9e7791 100644 --- a/tests/Util/FileHasherTest.php +++ b/tests/Util/FileHasherTest.php @@ -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 @@ -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); } }