mirror of https://github.com/rectorphp/rector.git
Updated Rector to commit 9fa5013b41ecee17113c56ad94f219bd1940e763
9fa5013b41
[Performance][Renaming] Remove unnecessary array_reverse() on RenameClassRector (#5266)
This commit is contained in:
parent
5980d06d27
commit
e071d037e3
|
@ -141,25 +141,23 @@ CODE_SAMPLE
|
|||
}
|
||||
private function restructureUnderNamespace(FileWithoutNamespace $fileWithoutNamespace) : void
|
||||
{
|
||||
$stmts = \array_reverse($fileWithoutNamespace->stmts, \true);
|
||||
$isBeforeNamespace = \false;
|
||||
$stmtsBeforeNamespace = [];
|
||||
$namepace = null;
|
||||
foreach ($stmts as $key => $stmt) {
|
||||
foreach ($fileWithoutNamespace->stmts as $key => $stmt) {
|
||||
if ($stmt instanceof Namespace_) {
|
||||
$isBeforeNamespace = \true;
|
||||
$namepace = $stmt;
|
||||
if ($stmtsBeforeNamespace !== []) {
|
||||
$stmt->stmts = \array_values(\array_merge(\is_array($stmtsBeforeNamespace) ? $stmtsBeforeNamespace : \iterator_to_array($stmtsBeforeNamespace), $stmt->stmts));
|
||||
}
|
||||
break;
|
||||
}
|
||||
if ($stmt instanceof Declare_) {
|
||||
continue;
|
||||
}
|
||||
if ($isBeforeNamespace && !$stmt instanceof Declare_) {
|
||||
$stmtsBeforeNamespace[] = $stmt;
|
||||
unset($stmts[$key]);
|
||||
}
|
||||
$stmtsBeforeNamespace[] = $stmt;
|
||||
unset($fileWithoutNamespace->stmts[$key]);
|
||||
}
|
||||
if ($stmtsBeforeNamespace === [] || !$namepace instanceof Namespace_) {
|
||||
if ($stmtsBeforeNamespace === []) {
|
||||
return;
|
||||
}
|
||||
$namepace->stmts = \array_values(\array_merge(\is_array($stmtsBeforeNamespace) ? $stmtsBeforeNamespace : \iterator_to_array($stmtsBeforeNamespace), $namepace->stmts));
|
||||
$fileWithoutNamespace->stmts = \array_values(\array_reverse($stmts, \true));
|
||||
$fileWithoutNamespace->stmts = \array_values($fileWithoutNamespace->stmts);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,12 +19,12 @@ final class VersionResolver
|
|||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '13284c60485e972ef72bf234b3c014c5f89e0d14';
|
||||
public const PACKAGE_VERSION = '9fa5013b41ecee17113c56ad94f219bd1940e763';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2023-11-19 10:12:03';
|
||||
public const RELEASE_DATE = '2023-11-19 22:46:19';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue