Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First comment in Method is ignored when using PhpFile::fromCode() #119

Closed
MaximilianSpeer opened this issue Oct 4, 2022 · 0 comments
Closed

Comments

@MaximilianSpeer
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant