Skip to content

Commit

Permalink
[NodeTypeResolver] Remove NodeScopeAndMetadataDecorator::decorateStmt…
Browse files Browse the repository at this point in the history
…sFromString() method (#3530)
  • Loading branch information
samsonasik committed Mar 28, 2023
1 parent 9c95c60 commit 87186dd
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 16 deletions.
12 changes: 0 additions & 12 deletions packages/NodeTypeResolver/NodeScopeAndMetadataDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,4 @@ public function decorateNodesFromFile(File $file, array $stmts): array

return $nodeTraverser->traverse($stmts);
}

/**
* @param Stmt[] $stmts
* @return Stmt[]
*/
public function decorateStmtsFromString(array $stmts): array
{
$nodeTraverser = new NodeTraverser();
$nodeTraverser->addVisitor($this->nodeConnectingVisitor);

return $nodeTraverser->traverse($stmts);
}
}
5 changes: 1 addition & 4 deletions src/PhpParser/Parser/InlineCodeParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
use Rector\Core\PhpParser\Node\Value\ValueResolver;
use Rector\Core\Util\StringUtils;
use Rector\NodeTypeResolver\Node\AttributeKey;
use Rector\NodeTypeResolver\NodeScopeAndMetadataDecorator;

final class InlineCodeParser
{
Expand Down Expand Up @@ -64,7 +63,6 @@ final class InlineCodeParser

public function __construct(
private readonly NodePrinterInterface $nodePrinter,
private readonly NodeScopeAndMetadataDecorator $nodeScopeAndMetadataDecorator,
private readonly SimplePhpParser $simplePhpParser,
private readonly ValueResolver $valueResolver
) {
Expand All @@ -84,8 +82,7 @@ public function parse(string $content): array
$content = StringUtils::isMatch($content, self::OPEN_PHP_TAG_REGEX) ? $content : '<?php ' . $content;
$content = StringUtils::isMatch($content, self::ENDING_SEMI_COLON_REGEX) ? $content : $content . ';';

$stmts = $this->simplePhpParser->parseString($content);
return $this->nodeScopeAndMetadataDecorator->decorateStmtsFromString($stmts);
return $this->simplePhpParser->parseString($content);
}

public function stringify(Expr $expr): string
Expand Down

0 comments on commit 87186dd

Please sign in to comment.