Skip to content

Commit

Permalink
[Scoped] Clean up SmartFileInfo (#2889)
Browse files Browse the repository at this point in the history
* [Scoped] Clean up SmartFileInfo

* [ci-review] Rector Rectify

Co-authored-by: GitHub Action <action@github.com>
  • Loading branch information
samsonasik and actions-user committed Sep 1, 2022
1 parent 2c454d2 commit dc22a95
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 47 deletions.
8 changes: 0 additions & 8 deletions build/target-repository/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,4 @@
$composerAutoloader->loadClass($class);
}
}

// @deprecated, to be removed
if ($class === 'Symplify\SmartFileSystem\SmartFileInfo') {
$filePath = __DIR__ . '/vendor/symplify/smart-file-system/src/SmartFileInfo.php';
if (file_exists($filePath)) {
require_once $filePath;
}
}
});
15 changes: 0 additions & 15 deletions packages/Testing/Fixture/FixtureFileFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Iterator;
use Symfony\Component\Finder\Finder;
use Symfony\Component\Finder\SplFileInfo;
use Symplify\SmartFileSystem\SmartFileInfo;

final class FixtureFileFinder
{
Expand All @@ -23,20 +22,6 @@ public static function yieldFilePathsFromDirectory(string $directory, string $su
}
}

/**
* @deprecated
*/
public static function yieldDirectory(string $directory, string $suffix = '*.php.inc'): Iterator
{
$fileInfos = self::findFilesInDirectory($directory, $suffix);

foreach ($fileInfos as $fileInfo) {
// @todo is this one needed? maybe symfony is good enough :)
$smartFileInfo = new SmartFileInfo($fileInfo->getRealPath());
yield [$smartFileInfo];
}
}

/**
* @return SplFileInfo[]
*/
Expand Down
10 changes: 0 additions & 10 deletions packages/Testing/PHPUnit/AbstractRectorTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
use Rector\Testing\Fixture\FixtureSplitter;
use Rector\Testing\Fixture\FixtureTempFileDumper;
use Rector\Testing\PHPUnit\Behavior\MovingFilesTrait;
use Symplify\SmartFileSystem\SmartFileInfo;

abstract class AbstractRectorTestCase extends AbstractTestCase implements RectorTestInterface
{
Expand Down Expand Up @@ -128,15 +127,6 @@ protected function doTestFile(string $fixtureFilePath): void
$this->doTestFileMatchesExpectedContent($inputFilePath, $expectedFilePath, $fixtureFilePath);
}

/**
* @deprecated Use doTestFile() with file path instead
*/
protected function doTestFileInfo(SmartFileInfo $fixtureFileInfo): void
{
$fixtureFileRealPath = $fixtureFileInfo->getRealPath();
$this->doTestFile($fixtureFileRealPath);
}

protected function getFixtureTempDirectory(): string
{
return FixtureTempFileDumper::getTempDirectory();
Expand Down
15 changes: 1 addition & 14 deletions scoper.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,7 @@
],

// expose
'expose-classes' => [
'Normalizer',
// used by public API
// @deprecated, to be removed
'Symplify\SmartFileSystem\SmartFileInfo',
],
'expose-classes' => ['Normalizer'],
'expose-functions' => ['u', 'b', 's', 'trigger_deprecation'],
'expose-constants' => ['__RECTOR_RUNNING__', '#^SYMFONY\_[\p{L}_]+$#'],

Expand All @@ -78,14 +73,6 @@
$content
),

// @deprecated - to be removed
// unprefixed SmartFileInfo - needed in AbstractTestCase
static fn (string $filePath, string $prefix, string $content): string => Strings::replace(
$content,
'#' . $prefix . '\\\\Symplify\\\\SmartFileSystem\\\\SmartFileInfo#',
'Symplify\SmartFileSystem\SmartFileInfo'
),

static function (string $filePath, string $prefix, string $content): string {
if (! \str_ends_with($filePath, 'src/Application/VersionResolver.php')) {
return $content;
Expand Down

0 comments on commit dc22a95

Please sign in to comment.