mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-18 22:08:00 +01:00
Updated Rector to commit 7584d25d55cd0a2e7c11dbc865c93a029c6047c3
7584d25d55
[AutoImport] Skip start with <?= short open tag on auto import (#5496)
This commit is contained in:
parent
cd34331aa7
commit
29d3544133
@ -19,12 +19,12 @@ final class VersionResolver
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = 'c2cdcd3922d06924acfbf4a792eec61dccbee03e';
|
||||
public const PACKAGE_VERSION = '7584d25d55cd0a2e7c11dbc865c93a029c6047c3';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2024-01-23 16:35:33';
|
||||
public const RELEASE_DATE = '2024-01-24 19:44:16';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
@ -88,8 +88,7 @@ final class NameImportingPostRector extends \Rector\PostRector\Rector\AbstractPo
|
||||
if (!$file instanceof File) {
|
||||
return null;
|
||||
}
|
||||
$firstStmt = \current($file->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] === '<?=';
|
||||
}
|
||||
private function processNodeName(FullyQualified $fullyQualified, File $file) : ?Node
|
||||
{
|
||||
if ($fullyQualified->isSpecialClassName()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user