Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<h1> {{ content }} </h1>
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use PhpParser\Node;
use PhpParser\Node\Name;
use PhpParser\Node\Stmt\Declare_;
use PhpParser\Node\Stmt\InlineHTML;
use PhpParser\Node\Stmt\Namespace_;
use Rector\Core\PhpParser\Node\CustomNode\FileWithoutNamespace;
use Rector\Core\Rector\AbstractRector;
Expand Down Expand Up @@ -80,6 +81,10 @@ public function getNodeTypes(): array
*/
public function refactor(Node $node): ?Node
{
if ($this->shouldSkip($node)) {
return null;
}

$expectedNamespace = $this->psr4AutoloadNamespaceMatcher->getExpectedNamespace($this->file, $node);
if ($expectedNamespace === null) {
return null;
Expand All @@ -101,6 +106,11 @@ public function refactor(Node $node): ?Node
return $node;
}

private function shouldSkip(Node $node): bool
{
return (bool) $this->betterNodeFinder->findFirstInstanceOf($node, InlineHTML::class);
}

private function refactorFileWithoutNamespace(
FileWithoutNamespace $fileWithoutNamespace,
string $expectedNamespace
Expand Down