SymfonyContainerCallsAnalyzer fix

This commit is contained in:
TomasVotruba 2017-09-29 13:03:59 +02:00
parent 577ae7ff89
commit a6fdc22465

View File

@ -3,7 +3,9 @@
namespace Rector\NodeAnalyzer;
use PhpParser\Node\Expr\MethodCall;
use PhpParser\Node\Expr\PropertyFetch;
use PhpParser\Node\Expr\Variable;
use PhpParser\Node\Identifier;
use PhpParser\Node\Scalar\String_;
final class SymfonyContainerCallsAnalyzer
@ -17,13 +19,14 @@ final class SymfonyContainerCallsAnalyzer
return false;
}
if ($methodCall->name instanceof Variable) {
$methodName = $methodCall->name->name;
} else {
$methodName = (string) $methodCall->name;
if (! $methodCall->name instanceof Identifier) {
return false;
}
if ($methodCall->var->name !== 'this' || $methodName !== 'get') {
$variableName = $methodCall->var->name;
$methodName = (string) $methodCall->name;
if ($variableName !== 'this' || $methodName !== 'get') {
return false;
}