[Rector] make PhpGeneratorDocumentMethodRector work

This commit is contained in:
TomasVotruba 2017-08-24 12:11:05 +02:00
parent 5cd643f279
commit 9bac151b41
2 changed files with 17 additions and 17 deletions

View File

@ -18,26 +18,25 @@ final class PhpGeneratorDocumentMethodRector extends AbstractChangeMethodNameRec
return 2.4;
}
protected function getClassName(): string
{
// allow array?
}
protected function getOldMethodName(): string
{
// return string
}
protected function getNewMethodName(): string
{
// retun string
}
/**
* @return string[][]
*/
protected function getPerClassOldToNewMethods(): array
{
// TODO: Implement getPerClassOldToNewMethods() method.
return [
'Nette\PhpGenerator\ClassType' => $this->commonMethods,
'Nette\PhpGenerator\Method' => $this->commonMethods,
'Nette\PhpGenerator\PhpFile' => $this->commonMethods,
'Nette\PhpGenerator\Property' => $this->commonMethods
];
}
/**
* @var string[]
*/
private $commonMethods = [
'addDocument' => 'addComment',
'setDocuments' => 'setComment',
'getDocuments' => 'getComment'
];
}

View File

@ -2,6 +2,7 @@
namespace Rector\Tests\Rector\Contrib\Nette\PhpGeneratorDocumentMethod;
use Rector\Rector\Contrib\Nette\PhpGeneratorDocumentMethodRector;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;
final class Test extends AbstractRectorTestCase
@ -19,6 +20,6 @@ final class Test extends AbstractRectorTestCase
*/
protected function getRectorClasses(): array
{
return [/* todo */];
return [PhpGeneratorDocumentMethodRector::class];
}
}