This commit is contained in:
TomasVotruba 2017-08-15 15:17:17 +02:00
parent 1f7c66bb72
commit 3e9f3b8342
7 changed files with 24 additions and 29 deletions

View File

@ -36,4 +36,4 @@ parameters:
- src/Rector/Contrib/Nette/NetteObjectToSmartTraitRector.php
Symplify\CodingStandard\Sniffs\Debug\CommentedOutCodeSniff:
# examples of code to be found
- src/NodeVisitor/DependencyInjection/NamedServicesToConstructor/GetterToPropertyRector.php
- src/Rector/Contrib/Symfony/GetterToPropertyRector.php

View File

@ -37,6 +37,4 @@ final class CollectorCompilerPass implements CompilerPassInterface
'addRector'
);
}
}

View File

@ -55,6 +55,16 @@ final class FormCallbackRector extends NodeVisitorAbstract implements Deprecatio
return null;
}
public function isCandidate(Node $node): bool
{
return true;
}
public function refactor(Node $node): ?Node
{
return $node;
}
private function isFormEventAssign(Node $node): bool
{
if (! $node instanceof PropertyFetch) {
@ -86,14 +96,4 @@ final class FormCallbackRector extends NodeVisitorAbstract implements Deprecatio
'kind' => Array_::KIND_SHORT,
]);
}
public function isCandidate(Node $node): bool
{
return true;
}
public function refactor(Node $node): ?Node
{
return $node;
}
}

View File

@ -92,9 +92,6 @@ final class GetterToPropertyRector extends AbstractRector
return false;
}
/**
* @param Node $assignOrMethodCallNode
*/
public function refactor(Node $assignOrMethodCallNode): ?Node
{
if ($assignOrMethodCallNode instanceof Assign) {
@ -114,6 +111,16 @@ final class GetterToPropertyRector extends AbstractRector
return $assignOrMethodCallNode;
}
public function getSetName(): string
{
return SetNames::SYMFONY;
}
public function sinceVersion(): float
{
return 3.3;
}
/**
* Is "$this->get('string')" statements?
*/
@ -168,14 +175,4 @@ final class GetterToPropertyRector extends AbstractRector
$propertyName
);
}
public function getSetName(): string
{
return SetNames::SYMFONY;
}
public function sinceVersion(): float
{
return 3.3;
}
}

View File

@ -21,6 +21,7 @@ final class RectorCollector
public function getRector(string $class): RectorInterface
{
$this->ensureRectorsIsFound($class);
return $this->rectors[$class];
}
@ -37,7 +38,7 @@ final class RectorCollector
$availableOptionsMessage = sprintf(
' Available rectors are: "%s".',
implode('", "' , $rectorClasses)
implode('", "', $rectorClasses)
);
throw new RectorNotFoundException(sprintf(

View File

@ -82,7 +82,7 @@ final class FileProcessor
$oldStmts = $this->parser->parse($fileContent);
$oldTokens = $this->lexer->getTokens();
$newStmts = $this->cloningNodeTraverser->traverse($oldStmts);
$newStmts = $this->cloningNodeTraverser->traverse($oldStmts);
$newStmts = $this->nodeTraverser->traverse($newStmts);

View File

@ -2,7 +2,6 @@
namespace Rector\Tests\Rector\Contrib\Nette\FormCallbackRector;
use Rector\Contract\Rector\RectorInterface;
use Rector\Rector\Contrib\Nette\FormCallbackRector;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;