mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-07 03:40:50 +00:00
Fix Scalar_Encapsed node as dynamic in ExprAnalyzer::isDynamicExpr()
(#2309)
* Add test to skip interpolated string conversion * Fix Scalar_Encapsed node as dynamic in ExprAnalyzer::isDynamicExpr()
This commit is contained in:
parent
26d2589aba
commit
f92d5deca3
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector\Fixture;
|
||||
|
||||
final class SkipComplexAssign
|
||||
{
|
||||
private $name;
|
||||
|
||||
public function __construct($name)
|
||||
{
|
||||
$this->name = "interpolated {$name}";
|
||||
}
|
||||
}
|
|
@ -13,6 +13,7 @@ use PhpParser\Node\FunctionLike;
|
|||
use PhpParser\Node\Identifier;
|
||||
use PhpParser\Node\Name;
|
||||
use PhpParser\Node\Scalar;
|
||||
use PhpParser\Node\Scalar\Encapsed;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
|
||||
use Rector\Core\NodeManipulator\ArrayManipulator;
|
||||
|
@ -68,7 +69,8 @@ final class ExprAnalyzer
|
|||
{
|
||||
if (! $expr instanceof Array_) {
|
||||
if ($expr instanceof Scalar) {
|
||||
return false;
|
||||
// string interpolation is true, otherwise false
|
||||
return $expr instanceof Encapsed;
|
||||
}
|
||||
|
||||
return ! $this->isAllowedConstFetchOrClassConstFetch($expr);
|
||||
|
|
Loading…
Reference in New Issue
Block a user