Merge pull request #493 from nmpolo/codegenerationfixes
Do not add trailing whitespace to blank lines
This commit is contained in:
commit
a44579303c
1 changed files with 4 additions and 2 deletions
|
@ -364,7 +364,7 @@ public function __construct()
|
|||
$body = str_replace('<spaces>', $this->spaces, $body);
|
||||
$last = strrpos($currentCode, '}');
|
||||
|
||||
return substr($currentCode, 0, $last) . $body . (strlen($body) > 0 ? "\n" : ''). "}";
|
||||
return substr($currentCode, 0, $last) . $body . (strlen($body) > 0 ? "\n" : ''). "}\n";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1213,7 +1213,9 @@ public function __construct()
|
|||
$lines = explode("\n", $code);
|
||||
|
||||
foreach ($lines as $key => $value) {
|
||||
$lines[$key] = str_repeat($this->spaces, $num) . $lines[$key];
|
||||
if ( ! empty($value)) {
|
||||
$lines[$key] = str_repeat($this->spaces, $num) . $lines[$key];
|
||||
}
|
||||
}
|
||||
|
||||
return implode("\n", $lines);
|
||||
|
|
Loading…
Add table
Reference in a new issue