mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-06 03:10:50 +00:00
[Nette] add NetteConfiguratorRector
This commit is contained in:
parent
1ec4797bed
commit
36d9c5f5e0
29
src/Rector/Contrib/Nette/NetteConfiguratorRector.php
Normal file
29
src/Rector/Contrib/Nette/NetteConfiguratorRector.php
Normal file
|
@ -0,0 +1,29 @@
|
|||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Rector\Rector\Contrib\Nette;
|
||||
|
||||
use Rector\Deprecation\SetNames;
|
||||
use Rector\Rector\AbstractClassReplacerRector;
|
||||
|
||||
final class NetteConfiguratorRector extends AbstractClassReplacerRector
|
||||
{
|
||||
public function getSetName(): string
|
||||
{
|
||||
return SetNames::NETTE;
|
||||
}
|
||||
|
||||
public function sinceVersion(): float
|
||||
{
|
||||
return 2.1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
protected function getOldToNewClasses(): array
|
||||
{
|
||||
return [
|
||||
'Nette\Config\Configurator' => 'Nette\Configurator'
|
||||
];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
<?php declare (strict_types=1);
|
||||
|
||||
$configurator = new \Nette\Configurator;
|
25
tests/Rector/Contrib/Nette/NetteConfiguratorRector/Test.php
Normal file
25
tests/Rector/Contrib/Nette/NetteConfiguratorRector/Test.php
Normal file
|
@ -0,0 +1,25 @@
|
|||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Rector\Tests\Rector\Contrib\Nette\NetteConfiguratorRector;
|
||||
|
||||
use Rector\Rector\Contrib\Nette\NetteConfiguratorRector;
|
||||
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
|
||||
|
||||
final class Test extends AbstractRectorTestCase
|
||||
{
|
||||
public function test(): void
|
||||
{
|
||||
$this->doTestFileMatchesExpectedContent(
|
||||
__DIR__ . '/Wrong/wrong.php.inc',
|
||||
__DIR__ . '/Correct/correct.php.inc'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
protected function getRectorClasses(): array
|
||||
{
|
||||
return [NetteConfiguratorRector::class];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
<?php declare (strict_types=1);
|
||||
|
||||
$configurator = new Nette\Config\Configurator;
|
Loading…
Reference in New Issue
Block a user