The inline comment declared begin with // besides constants get lost after fromCode and printFile
Steps To Reproduce
$file = \Nette\PhpGenerator\PhpFile::fromCode(<<<'PHP'
<?php
class A {
public const HELLO = 'hello'; // some comment
public function say(string $to): string {
// just combine hello and $to
return static::HELLO . ' ' . $to;
}
}
PHP
);
echo (new \Nette\PhpGenerator\PsrPrinter())->printFile($file);
Actual Result
<?php
class A
{
public const HELLO = 'hello';
public function say(string $to): string
{
// just combine hello and $to
return static::HELLO . ' ' . $to;
}
}
Expected Behavior
Keep the inline comment as well.
<?php
class A
{
public const HELLO = 'hello'; // some comment
public function say(string $to): string
{
// just combine hello and $to
return static::HELLO . ' ' . $to;
}
}
Version: 4.0.6
Bug Description
The inline comment declared begin with
//
besides constants get lost afterfromCode
andprintFile
Steps To Reproduce
Actual Result
Expected Behavior
Keep the inline comment as well.