Closed Jeroeny closed 5 years ago
php version: 7.3.0 nette/php-generator version: 3.2.1
When adding a constant to a class as below
$map = [ 'foo' => 'bar', 'example' => 'value', ]; $class ->addConstant('MAP', $map) ->setVisibility(ClassType::VISIBILITY_PROTECTED);
it results in:
protected const MAP = [ 'foo' => 'bar', 'example' => 'value', ];
When printing with Nette\PhpGenerator\PsrPrinter.
Nette\PhpGenerator\PsrPrinter
The constant printed with PsrPrinter's 4 spaces indentation instead of tabs.
The tab is hardcoded at https://github.com/nette/php-generator/blob/master/src/PhpGenerator/Helpers.php#L74. Could we change it so that we can pass the indentation to the helper?
I also have this issue.
@zeleznypa I've worked around this with:
Nette\PhpGenerator\Helpers::tabsToSpaces($contents);
php version: 7.3.0 nette/php-generator version: 3.2.1
Bug Description
When adding a constant to a class as below
it results in:
When printing with
Nette\PhpGenerator\PsrPrinter
.Expected Behavior
The constant printed with PsrPrinter's 4 spaces indentation instead of tabs.
Possible Solution
The tab is hardcoded at https://github.com/nette/php-generator/blob/master/src/PhpGenerator/Helpers.php#L74. Could we change it so that we can pass the indentation to the helper?