mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-19 06:18:07 +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
|
* @api
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const PACKAGE_VERSION = 'c2cdcd3922d06924acfbf4a792eec61dccbee03e';
|
public const PACKAGE_VERSION = '7584d25d55cd0a2e7c11dbc865c93a029c6047c3';
|
||||||
/**
|
/**
|
||||||
* @api
|
* @api
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const RELEASE_DATE = '2024-01-23 16:35:33';
|
public const RELEASE_DATE = '2024-01-24 19:44:16';
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
|
@ -88,8 +88,7 @@ final class NameImportingPostRector extends \Rector\PostRector\Rector\AbstractPo
|
|||||||
if (!$file instanceof File) {
|
if (!$file instanceof File) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
$firstStmt = \current($file->getNewStmts());
|
if ($this->shouldSkipFileWithoutNamespace($file)) {
|
||||||
if ($firstStmt instanceof FileWithoutNamespace && \current($firstStmt->stmts) instanceof InlineHTML) {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if ($node instanceof FullyQualified) {
|
if ($node instanceof FullyQualified) {
|
||||||
@ -113,6 +112,20 @@ final class NameImportingPostRector extends \Rector\PostRector\Rector\AbstractPo
|
|||||||
$this->docBlockUpdater->updateRefactoredNodeWithPhpDocInfo($node);
|
$this->docBlockUpdater->updateRefactoredNodeWithPhpDocInfo($node);
|
||||||
return $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
|
private function processNodeName(FullyQualified $fullyQualified, File $file) : ?Node
|
||||||
{
|
{
|
||||||
if ($fullyQualified->isSpecialClassName()) {
|
if ($fullyQualified->isSpecialClassName()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user