Skip to content

PSR2 MultiLineFunctionDeclaration forbids comments after opening parenthesis of a multiline call #794

@VasekPurchart

Description

@VasekPurchart

Hi,

I was just going through release notes of 2.4 and I have noticed that since #768 it is possible to write comments after opening parenthesis in multiline calls, that's great for me, I always thought that this will never be changed. Since we have this change I think comments should be allowed in declaration as well. Because now the call is ok, but declaration throws error in PSR2:

function foo( // this throws an error $bar, $baz ) { // this comment is ok // ... } foo( // this comment is ok 'bar', 'baz' );
 3 | ERROR | [x] The first parameter of a multi-line function | | declaration must be on the line after the opening | | bracket | | (Squiz.Functions.MultiLineFunctionDeclaration.FirstParamSpacing) 

What's more, the error message is somewhat misleading.

I would probably never write such a declaration, but this applies also to anonymous functions, where it's much more likely.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions