First comment in Method is ignored when using PhpFile::fromCode()
MaximilianSpeer opened this issue · comments
Version: 3.6.7
Bug Description
The PhpParser ignores a comment if it's in the first line of a method. This occurses when using PhpFile::fromCode()
Steps To Reproduce
`$code = "<?php
class TestClass
{
function aFunction()
{
// a Comment
\$foo = 'bar';
// another Comment
}
}";
$file = PhpFile::fromCode($code);
$newCode = (string) $file;
echo $newCode;
return;`
Expected Behavior
The first comment should get extracted from the code and stored in the PhpFile object.