Skip to content

Commit

Permalink
Refactor from PARENT_NODE in EncapsedStringsToSprintfRector (#3960)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba authored May 25, 2023
1 parent fc1fabe commit 18ac565
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 32 deletions.
2 changes: 1 addition & 1 deletion packages/PostRector/Rector/ClassRenamingPostRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

namespace Rector\PostRector\Rector;

use PhpParser\Node\Stmt;
use PhpParser\Node;
use PhpParser\Node\Stmt;
use PhpParser\Node\Stmt\Namespace_;
use PHPStan\Analyser\Scope;
use Rector\CodingStyle\Application\UseImportsRemover;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

namespace Rector\CodeQuality\Rector\Foreach_;

use PhpParser\Node\Stmt;
use PhpParser\Node;
use PhpParser\Node\Expr;
use PhpParser\Node\Expr\Assign;
use PhpParser\Node\Expr\Variable;
use PhpParser\Node\Stmt;
use PhpParser\Node\Stmt\Expression;
use PhpParser\Node\Stmt\Foreach_;
use PHPStan\Analyser\Scope;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,24 +97,6 @@ public function refactor(Node $node): ?Node

private function shouldSkip(Encapsed $encapsed): bool
{
$parentNode = $encapsed->getAttribute(AttributeKey::PARENT_NODE);

if ($parentNode instanceof Arg) {
$node = $parentNode->getAttribute(AttributeKey::PARENT_NODE);

if ($node instanceof FuncCall && $this->isNames($node, [
'_',
'dcgettext',
'dcngettext',
'dgettext',
'dngettext',
'gettext',
'ngettext',
])) {
return true;
}
}

return $encapsed->hasAttribute(AttributeKey::DOC_LABEL);
}

Expand Down

0 comments on commit 18ac565

Please sign in to comment.