diff --git a/rules/transform/src/Rector/StaticCall/StaticCallToNewRector.php b/rules/transform/src/Rector/StaticCall/StaticCallToNewRector.php index ad8981542462..370f730aa9f0 100644 --- a/rules/transform/src/Rector/StaticCall/StaticCallToNewRector.php +++ b/rules/transform/src/Rector/StaticCall/StaticCallToNewRector.php @@ -5,6 +5,8 @@ namespace Rector\Transform\Rector\StaticCall; use PhpParser\Node; +use PhpParser\Node\Expr\New_; +use PhpParser\Node\Expr\StaticCall; use PhpParser\Node\Name\FullyQualified; use Rector\Core\Contract\Rector\ConfigurableRectorInterface; use Rector\Core\Rector\AbstractRector; @@ -65,7 +67,7 @@ public function run() */ public function getNodeTypes(): array { - return [Node\Expr\StaticCall::class]; + return [StaticCall::class]; } /** @@ -87,7 +89,7 @@ public function refactor(Node $node): ?Node continue; } - return new Node\Expr\New_(new FullyQualified($class)); + return new New_(new FullyQualified($class)); } return $node; diff --git a/rules/transform/tests/Rector/New_/NewArgToMethodCallRector/NewArgToMethodCallRectorTest.php b/rules/transform/tests/Rector/New_/NewArgToMethodCallRector/NewArgToMethodCallRectorTest.php index a79c594ebca2..c130548a1630 100644 --- a/rules/transform/tests/Rector/New_/NewArgToMethodCallRector/NewArgToMethodCallRectorTest.php +++ b/rules/transform/tests/Rector/New_/NewArgToMethodCallRector/NewArgToMethodCallRectorTest.php @@ -4,22 +4,24 @@ namespace Rector\Transform\Tests\Rector\New_\NewArgToMethodCallRector; +use Iterator; use Rector\Testing\PHPUnit\AbstractRectorTestCase; use Rector\Transform\Rector\New_\NewArgToMethodCallRector; use Rector\Transform\Tests\Rector\New_\NewArgToMethodCallRector\Source\SomeDotenv; use Rector\Transform\ValueObject\NewArgToMethodCall; +use Symplify\SmartFileSystem\SmartFileInfo; final class NewArgToMethodCallRectorTest extends AbstractRectorTestCase { /** * @dataProvider provideData() */ - public function test(\Symplify\SmartFileSystem\SmartFileInfo $fileInfo): void + public function test(SmartFileInfo $fileInfo): void { $this->doTestFileInfo($fileInfo); } - public function provideData(): \Iterator + public function provideData(): Iterator { return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture'); } diff --git a/rules/transform/tests/Rector/StaticCall/StaticCallToNewRector/StaticCallToNewRectorTest.php b/rules/transform/tests/Rector/StaticCall/StaticCallToNewRector/StaticCallToNewRectorTest.php index 63962c9d703f..90903ffbdfae 100644 --- a/rules/transform/tests/Rector/StaticCall/StaticCallToNewRector/StaticCallToNewRectorTest.php +++ b/rules/transform/tests/Rector/StaticCall/StaticCallToNewRector/StaticCallToNewRectorTest.php @@ -4,20 +4,23 @@ namespace Rector\Transform\Tests\Rector\StaticCall\StaticCallToNewRector; +use Iterator; use Rector\Testing\PHPUnit\AbstractRectorTestCase; +use Rector\Transform\Rector\StaticCall\StaticCallToNewRector; use Rector\Transform\Tests\Rector\StaticCall\StaticCallToNewRector\Source\SomeJsonResponse; +use Symplify\SmartFileSystem\SmartFileInfo; final class StaticCallToNewRectorTest extends AbstractRectorTestCase { /** * @dataProvider provideData() */ - public function test(\Symplify\SmartFileSystem\SmartFileInfo $fileInfo): void + public function test(SmartFileInfo $fileInfo): void { $this->doTestFileInfo($fileInfo); } - public function provideData(): \Iterator + public function provideData(): Iterator { return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture'); } @@ -28,9 +31,9 @@ public function provideData(): \Iterator protected function getRectorsWithConfiguration(): array { return [ - \Rector\Transform\Rector\StaticCall\StaticCallToNewRector::class => + StaticCallToNewRector::class => [ - \Rector\Transform\Rector\StaticCall\StaticCallToNewRector::STATIC_CALLS_TO_NEWS => [ + StaticCallToNewRector::STATIC_CALLS_TO_NEWS => [ SomeJsonResponse::class => 'create', ], ],