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

SquizMultiLineFunctionDeclaration error when param has trailing comment #1959

Closed
gsouf opened this issue Mar 23, 2018 · 2 comments · Fixed by #1965
Closed

SquizMultiLineFunctionDeclaration error when param has trailing comment #1959

gsouf opened this issue Mar 23, 2018 · 2 comments · Fixed by #1965
Milestone

Comments

@gsouf
Copy link

gsouf commented Mar 23, 2018

Hi,

I'm encountering issue with Squiz.Functions.MultiLineFunctionDeclaration.OneParamPerLine snif.

The following works perfectly:

    public function __construct(
        $foo,
        $bar
    ) {

while the following wont:

    public function __construct(
        $foo,   // This is foo
        $bar
    ) {

and triggers error - Multi-line function declarations must define one parameter per line (Squiz.Functions.MultiLineFunctionDeclaration.OneParamPerLine)

Please note that the following is working:

    public function __construct(
        $foo /* this is foo */,
        $bar // this is bar
    ) {
@gsherwood
Copy link
Member

gsherwood commented Mar 24, 2018

I think it wants the comma to be the last thing on the line, but comments should be ignored by this check. No idea why the last code block works though. Will investigate when fixing.

@gsherwood gsherwood added this to the 3.3.0 milestone Mar 24, 2018
@jrfnl
Copy link
Contributor

jrfnl commented Mar 24, 2018

@gsouf @gsherwood Had a quick look and turned out to be a very simple fix ;-) See PR #1965

@gsherwood gsherwood changed the title Issue with Squiz.Functions.MultiLineFunctionDeclaration.OneParamPerLine SquizMultiLineFunctionDeclaration error when param has trailing comment Mar 25, 2018
gsherwood added a commit that referenced this issue Mar 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants