Skip to content

Commit

Permalink
[DX] Cleanup of text file processor, unused MultipleFilesChangedTrait…
Browse files Browse the repository at this point in the history
… and misc (#2861)
  • Loading branch information
TomasVotruba committed Aug 30, 2022
1 parent cf65fca commit bb3ced4
Show file tree
Hide file tree
Showing 16 changed files with 14 additions and 426 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
use Rector\BetterPhpDocParser\ValueObject\PhpDoc\DoctrineAnnotation\CurlyListNode;
use Rector\Core\Exception\ShouldNotHappenException;
use Rector\Core\PhpParser\Node\BetterNodeFinder;
use Rector\Core\Provider\CurrentFileProvider;
use Rector\Core\ValueObject\Application\File;
use Rector\FileSystemRector\Parser\FileInfoParser;
use Rector\Testing\PHPUnit\AbstractTestCase;
use Symplify\EasyTesting\StaticFixtureSplitter;
Expand All @@ -32,8 +30,6 @@ final class TestModifyReprintTest extends AbstractTestCase

private PhpDocInfoFactory $phpDocInfoFactory;

private CurrentFileProvider $currentFileProvider;

protected function setUp(): void
{
$this->boot();
Expand All @@ -43,7 +39,6 @@ protected function setUp(): void
$this->betterNodeFinder = $this->getService(BetterNodeFinder::class);
$this->phpDocInfoPrinter = $this->getService(PhpDocInfoPrinter::class);
$this->phpDocInfoFactory = $this->getService(PhpDocInfoFactory::class);
$this->currentFileProvider = $this->getService(CurrentFileProvider::class);
}

public function test(): void
Expand All @@ -53,7 +48,6 @@ public function test(): void
$inputFileInfoAndExpected = StaticFixtureSplitter::splitFileInfoToLocalInputAndExpected($fixtureFileInfo);
$inputFileInfo = $inputFileInfoAndExpected->getInputFileInfo();

$this->currentFileProvider->setFile(new File($inputFileInfo, $inputFileInfo->getContents()));
$phpDocInfo = $this->parseFileAndGetFirstNodeOfType($inputFileInfo, ClassMethod::class);

/** @var DoctrineAnnotationTagValueNode $doctrineAnnotationTagValueNode */
Expand Down
2 changes: 0 additions & 2 deletions packages/Testing/PHPUnit/AbstractRectorTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
use Rector\NodeTypeResolver\Reflection\BetterReflection\SourceLocatorProvider\DynamicSourceLocatorProvider;
use Rector\Testing\Contract\RectorTestInterface;
use Rector\Testing\PHPUnit\Behavior\MovingFilesTrait;
use Rector\Testing\PHPUnit\Behavior\MultipleFilesChangedTrait;
use Symplify\EasyTesting\DataProvider\StaticFixtureFinder;
use Symplify\EasyTesting\DataProvider\StaticFixtureUpdater;
use Symplify\EasyTesting\StaticFixtureSplitter;
Expand All @@ -28,7 +27,6 @@
abstract class AbstractRectorTestCase extends AbstractTestCase implements RectorTestInterface
{
use MovingFilesTrait;
use MultipleFilesChangedTrait;

protected ParameterProvider $parameterProvider;

Expand Down
116 changes: 0 additions & 116 deletions packages/Testing/PHPUnit/Behavior/MultipleFilesChangedTrait.php

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ class Fixture
foreach ($items as $key => $value) {
$result = $value;
}

foreach ($items as $key => $value) {
$result = $key;
}
}
}

Expand All @@ -31,10 +27,6 @@ class Fixture
foreach ($items as $value) {
$result = $value;
}

foreach ($items as $key => $value) {
$result = $key;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace Rector\Tests\DeadCode\Rector\Foreach_\RemoveUnusedForeachKeyRector\Fixture;

final class SkipUsedKey
{
public function run()
{
$items = [];
foreach ($items as $key => $value) {
$result = $key;
}
}
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit bb3ced4

Please sign in to comment.