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

Commenting.FunctionComment.InvalidReturnVoid conditional issue with anonymous classes #1276

Closed
pavloivanov opened this issue Jan 17, 2017 · 3 comments

Comments

@pavloivanov
Copy link

Commenting a method with @return void triggers an
InvalidReturnVoid error:
Function return type is void, but function contains return statement (....Commenting.FunctionComment.InvalidReturnVoid)
when the method contains anonymous class that contains a return.

Example:

<?php

namespace Test;

/**
 * Class AnonTest
 */
class AnonTest
{
    /**
     * do something
     *
     * @return void
     */
    public function someFunc(): void
    {
        $class = new class
        {
            /**
             * Getter
             *
             * @return string
             */
            public function getString(): string
            {
                return 'some string';
            }
        };
        echo $class->getString();
    }
}
@pavloivanov pavloivanov changed the title Commenting.FunctionComment.InvalidReturnVoid conditional issue with anon classes Commenting.FunctionComment.InvalidReturnVoid conditional issue with anonymous classes Jan 17, 2017
gsherwood added a commit that referenced this issue Jan 17, 2017
@gsherwood
Copy link
Member

Fixed now. Thanks for the bug report.

@pavloivanov
Copy link
Author

pavloivanov commented Jan 18, 2017

NP, Thank you!
Will it be included in 2.* version?

@gsherwood
Copy link
Member

Will it be included in 2.* version?

Yes, it will be in both the next 2.x and 3.x release.

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

No branches or pull requests

2 participants