fix enscaped type resolution

This commit is contained in:
TomasVotruba 2020-02-08 14:10:38 +01:00
parent 7f453d2d6f
commit d4c8fbd88f
2 changed files with 20 additions and 0 deletions

View File

@ -7,12 +7,14 @@ namespace Rector\NodeTypeResolver\PerNodeTypeResolver;
use PhpParser\Node;
use PhpParser\Node\Scalar;
use PhpParser\Node\Scalar\DNumber;
use PhpParser\Node\Scalar\Encapsed;
use PhpParser\Node\Scalar\LNumber;
use PhpParser\Node\Scalar\MagicConst;
use PhpParser\Node\Scalar\String_;
use PHPStan\Type\Constant\ConstantFloatType;
use PHPStan\Type\Constant\ConstantIntegerType;
use PHPStan\Type\Constant\ConstantStringType;
use PHPStan\Type\MixedType;
use PHPStan\Type\Type;
use Rector\Core\Exception\NotImplementedException;
use Rector\NodeTypeResolver\Contract\PerNodeTypeResolver\PerNodeTypeResolverInterface;
@ -42,6 +44,10 @@ final class ScalarTypeResolver implements PerNodeTypeResolverInterface
return new ConstantStringType($node->getName());
}
if ($node instanceof Encapsed) {
return new MixedType();
}
throw new NotImplementedException();
}
}

View File

@ -0,0 +1,14 @@
<?php
namespace Rector\Php71\Tests\Rector\BinaryOp\BinaryOpBetweenNumberAndStringRector\Fixture;
class SkipEncapsed
{
public function run()
{
// put file content here
$a = "test";
$b = "that is test";
assert($b=="this is $a");
}
}