This commit is contained in:
TomasVotruba 2017-07-19 00:15:26 +02:00
parent 3a6eee57f3
commit ebe7698bae
5 changed files with 8 additions and 30 deletions

View File

@ -17,7 +17,7 @@
"require-dev": {
"phpunit/phpunit": "^6.2",
"tracy/tracy": "^2.4",
"symplify/easy-coding-standard": "^2.1",
"symplify/easy-coding-standard": "@dev",
"phpstan/phpstan": "^0.7"
},
"autoload": {

View File

@ -1,3 +1 @@
includes:
checkers:

View File

@ -4,8 +4,6 @@ namespace Rector\DependencyInjection\CompilerPass;
use PhpParser\NodeTraverser;
use PhpParser\NodeVisitor;
use Rector\Contract\Dispatcher\ReconstructorInterface;
use Rector\Dispatcher\NodeDispatcher;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;

View File

@ -101,28 +101,4 @@ final class InjectAnnotationToConstructorNodeVisitor extends NodeVisitorAbstract
return NodeTraverser::DONT_TRAVERSE_CHILDREN;
}
/**
* Called when leaving a node.
*
* Return value semantics:
* * null
* => $node stays as-is
* * NodeTraverser::REMOVE_NODE
* => $node is removed from the parent array
* * NodeTraverser::STOP_TRAVERSAL
* => Traversal is aborted. $node stays as-is
* * array (of Nodes)
* => The return value is merged into the parent array (at the position of the $node)
* * otherwise
* => $node is set to the return value
*
* @param Node $node Node
*
* @return null|int|Node|Node[] Replacement node (or special return value)
*/
public function leaveNode(Node $node)
{
// TODO: Implement leaveNode() method.
}
}

View File

@ -11,6 +11,7 @@ use PhpParser\Node\Expr\Variable;
use PhpParser\Node\Scalar\String_;
use PhpParser\Node\Stmt\Class_;
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\NodeTraverser;
use PhpParser\NodeVisitorAbstract;
use Rector\Analyzer\ClassAnalyzer;
use Rector\Builder\ConstructorMethodBuilder;
@ -228,6 +229,11 @@ final class NamedServicesToConstructorNodeVisitor extends NodeVisitorAbstract
*/
public function enterNode(Node $node)
{
return $this->isCandidate($node);
if ($this->isCandidate($node)) {
$this->reconstruct($node);
return;
}
return NodeTraverser::DONT_TRAVERSE_CHILDREN;
}
}