mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-26 20:53:31 +00:00
skip encapsed string from constant extraction
This commit is contained in:
parent
e9ebf725d4
commit
5b8bf939a6
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\SOLID\Tests\Rector\ClassMethod\ChangeReadOnlyVariableWithDefaultValueToConstantRector\Fixture;
|
||||
|
||||
class SkipEnscapedString
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$testsBaseDir = "{$this->testSuite->rootPath}/tests";
|
||||
|
||||
return $testsBaseDir;
|
||||
}
|
||||
}
|
|
@ -10,6 +10,7 @@ use PhpParser\Node\Expr\Array_;
|
|||
use PhpParser\Node\Expr\Assign;
|
||||
use PhpParser\Node\Expr\Variable;
|
||||
use PhpParser\Node\Scalar;
|
||||
use PhpParser\Node\Scalar\Encapsed;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use Rector\Core\PhpParser\Node\BetterNodeFinder;
|
||||
use Rector\Core\PhpParser\NodeTraverser\CallableNodeTraverser;
|
||||
|
@ -87,6 +88,10 @@ final class VariableManipulator
|
|||
return null;
|
||||
}
|
||||
|
||||
if ($node->expr instanceof Encapsed) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($node->expr instanceof Array_ && ! $this->arrayManipulator->isArrayOnlyScalarValues($node->expr)) {
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user