From fcad8bbf912240ed1feabb9eef4140ddc561e55a Mon Sep 17 00:00:00 2001 From: Abderrahim Darghal Belkacemi Date: Mon, 13 Jul 2026 11:18:00 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20indentaci=C3=B3n=20al=20insertar=20c?= =?UTF-8?q?=C3=B3digo=20en=20funciones=20vac=C3=ADas=20de=20Init.php?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/InitEditor.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/InitEditor.php b/src/InitEditor.php index d7f4cc9..46b9262 100644 --- a/src/InitEditor.php +++ b/src/InitEditor.php @@ -111,6 +111,10 @@ public static function addToFunction(string $functionName, string $instructionSt // agregar indentation $indentation = self::getCurrentIndentation($body, mb_strlen($body) - 2); + if ($indentation === '') { + // función vacía: no hay línea previa de la que copiar la indentación + $indentation = $endIndents . ' '; + } $body .= self::formatTextWithIndentation($instructionStr, $indentation) . "\n" . $endIndents; return mb_substr($info['initContent'], 0, $info['functionStart']) . $body . mb_substr($info['initContent'], $info['functionEnd']);