nette / php-generator

🐘 Generates neat PHP code for you. Supports new PHP 8.3 features.
https://doc.nette.org/php-generator
Other
2.11k stars 138 forks source link

Make space between closing method parentheses and colon configurable #63

Closed merlindiavova closed 4 years ago

merlindiavova commented 4 years ago

Our coding standards enforces a space after the closing method parentheses and the proceeding colon. It would super advantageous if this space could be configurable and honored in the printReturnType method.

Currently we have to manually go to all generated files and apply the spacing. As you can imagine this is very monotonous. I'm sure many others could also benefit from this.

I would super happy to contribute a PR if this is taken into consideration.

dg commented 4 years ago

Fixed, now you can create your custom printer:


class MyPrinter extends Nette\PhpGenerator\Printer
{
    public function __construct()
    {
        $this->returnTypeColon = ' : ';
    }
}
merlindiavova commented 4 years ago

Amazing! Thank you for your prompt action and response!