prevent circular type resolving for just added node

This commit is contained in:
TomasVotruba 2018-01-08 19:17:00 +01:00
parent 37a552ced7
commit d9899e4522
2 changed files with 11 additions and 0 deletions

View File

@ -5,6 +5,7 @@ namespace Rector\Rector\Contrib\Nette\Application;
use PhpParser\Node;
use PhpParser\Node\Expr\MethodCall;
use PhpParser\Node\Identifier;
use Rector\Node\Attribute;
use Rector\Node\MethodCallNodeFactory;
use Rector\Node\NodeFactory;
use Rector\NodeAnalyzer\MethodCallAnalyzer;
@ -54,6 +55,11 @@ final class TemplateMagicInvokeFilterCallRector extends AbstractRector
public function isCandidate(Node $node): bool
{
// skip just added calls
if ($node->getAttribute(Attribute::ORIGINAL_NODE) === null) {
return false;
}
return $this->methodCallAnalyzer->isTypeAndMagic($node, 'Nette\Bridges\ApplicationLatte\Template');
}

View File

@ -38,6 +38,11 @@ final class FormIsValidRector extends AbstractRector
public function isCandidate(Node $node): bool
{
// skip just added calls
if ($node->getAttribute(Attribute::ORIGINAL_NODE) === null) {
return false;
}
if (! $this->methodCallAnalyzer->isTypeAndMethod(
$node,
'Symfony\Component\Form\Form',