1
0
mirror of synced 2025-01-19 15:01:40 +03:00

Merge pull request #493 from nmpolo/codegenerationfixes

Do not add trailing whitespace to blank lines
This commit is contained in:
Guilherme Blanco 2012-11-05 16:19:39 -08:00
commit a44579303c

View File

@ -364,7 +364,7 @@ public function __construct()
$body = str_replace('<spaces>', $this->spaces, $body); $body = str_replace('<spaces>', $this->spaces, $body);
$last = strrpos($currentCode, '}'); $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,8 +1213,10 @@ public function __construct()
$lines = explode("\n", $code); $lines = explode("\n", $code);
foreach ($lines as $key => $value) { foreach ($lines as $key => $value) {
if ( ! empty($value)) {
$lines[$key] = str_repeat($this->spaces, $num) . $lines[$key]; $lines[$key] = str_repeat($this->spaces, $num) . $lines[$key];
} }
}
return implode("\n", $lines); return implode("\n", $lines);
} }