!fixup fix rector rule

This commit is contained in:
Julien Fastré 2025-03-11 15:28:28 +01:00
parent 49f4cce72a
commit 93f934152f
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB

View File

@ -96,6 +96,7 @@ class ChillBundleAddNormalizationMethodsOnExportRector extends AbstractRector
}
}
$toAddBefore = [];
$toAdd = [];
$stmtBefore = array_slice($node->stmts, 0, $buildFormStmtIndex, false);
@ -114,9 +115,9 @@ class ChillBundleAddNormalizationMethodsOnExportRector extends AbstractRector
},
false,
)) {
array_unshift($stmtBefore, new Node\Stmt\TraitUse([
$toAddBefore[] = new Node\Stmt\TraitUse([
new Node\Name('\\'.ExportDataNormalizerTrait::class),
]));
]);
}
// if we do not have the `getNormalizerVersion` method
@ -134,6 +135,7 @@ class ChillBundleAddNormalizationMethodsOnExportRector extends AbstractRector
}
$node->stmts = [
...array_values($toAddBefore),
...array_values($stmtBefore),
$buildForm,
...array_values($toAdd),