Skip to content

Commit 68233f6

Browse files
committed
Helpers::unindent() fixed when level = 0
1 parent 018ed92 commit 68233f6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/PhpGenerator/Helpers.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,9 @@ public static function unformatDocComment(string $comment): string
9191

9292
public static function unindent(string $s, int $level = 1): string
9393
{
94-
return preg_replace('#^(\t|\ \ \ \ ){1,' . $level . '}#m', '', $s);
94+
return $level
95+
? preg_replace('#^(\t|\ \ \ \ ){1,' . $level . '}#m', '', $s)
96+
: $s;
9597
}
9698

9799

0 commit comments

Comments
 (0)