Skip to content

Commit

Permalink
[PostRector] Improve performance NameImportingPostRector (#3708)
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed Apr 29, 2023
1 parent 0451834 commit 2bb26e3
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions packages/PostRector/Rector/NameImportingPostRector.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use Rector\CodingStyle\Node\NameImporter;
use Rector\Core\Configuration\Option;
use Rector\Core\Configuration\Parameter\ParameterProvider;
use Rector\Core\PhpParser\Node\CustomNode\FileWithoutNamespace;
use Rector\Core\Provider\CurrentFileProvider;
use Rector\Core\ValueObject\Application\File;
use Rector\Naming\Naming\AliasNameResolver;
Expand Down Expand Up @@ -54,13 +55,8 @@ public function enterNode(Node $node): ?Node
return null;
}

$currentStmt = current($file->getOldStmts());
if ($currentStmt instanceof InlineHTML) {
return null;
}

$currentStmt = current($file->getNewStmts());
if ($currentStmt instanceof InlineHTML) {
if ($currentStmt instanceof FileWithoutNamespace && current($currentStmt->stmts) instanceof InlineHTML) {
return null;
}

Expand Down

0 comments on commit 2bb26e3

Please sign in to comment.