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

File comment is lost when using PhpFile::fromCode #100

Closed red-led closed 2 years ago

red-led commented 2 years ago

Version: 3.6.5

Bug Description

When unsing PhpFile::fromCode file comment is lost

Steps To Reproduce

<?php

$code = <<<TEST
<?php

/**
 * This is file comment. Is will be lost
 */

namespace Test;

/**
 * This is class comment. Is will be preserved
 */
class A {
}
TEST;

$file = Nette\PhpGenerator\PhpFile::fromCode($code);

echo $file;

Expected Behavior

First comment is expected to be in output.