From 29d3544133f9394a793d801cb08102710e564b84 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Wed, 24 Jan 2024 12:46:29 +0000 Subject: [PATCH] Updated Rector to commit 7584d25d55cd0a2e7c11dbc865c93a029c6047c3 https://github.com/rectorphp/rector-src/commit/7584d25d55cd0a2e7c11dbc865c93a029c6047c3 [AutoImport] Skip start with getNewStmts()); - if ($firstStmt instanceof FileWithoutNamespace && \current($firstStmt->stmts) instanceof InlineHTML) { + if ($this->shouldSkipFileWithoutNamespace($file)) { return null; } if ($node instanceof FullyQualified) { @@ -113,6 +112,20 @@ final class NameImportingPostRector extends \Rector\PostRector\Rector\AbstractPo $this->docBlockUpdater->updateRefactoredNodeWithPhpDocInfo($node); return $node; } + private function shouldSkipFileWithoutNamespace(File $file) : bool + { + $firstStmt = \current($file->getNewStmts()); + if (!$firstStmt instanceof FileWithoutNamespace) { + return \false; + } + $currentStmt = \current($firstStmt->stmts); + if ($currentStmt instanceof InlineHTML || $currentStmt === \false) { + return \true; + } + $oldTokens = $file->getOldTokens(); + $tokenStartPos = $currentStmt->getStartTokenPos(); + return isset($oldTokens[$tokenStartPos][1]) && $oldTokens[$tokenStartPos][1] === 'isSpecialClassName()) {