Skip to content

Conversation

jrfnl
Copy link
Contributor

@jrfnl jrfnl commented May 10, 2021

Adjusts the PEAR.Functions.FunctionDeclaration sniff and by extension, the Squiz.Functions.MultiLineFunctionDeclaration and the PSR12.Classes.AnonClassDeclaration sniffs to handle constructor properties preceded by docblocks correctly.

There is one functional change:
The sniffs will no longer throw a FirstParamSpacing error when there are blank lines between the function open parenthesis and the first parameter.
As the sniffs still throws an EmptyLine error in that case - and will auto-fix that error - I've deemed that acceptable as the "fixed" file will still be the same.

Fixes #3342

…rty promotion

Adjusts the `PEAR.Functions.FunctionDeclaration` sniff and by extension, the `Squiz.Functions.MultiLineFunctionDeclaration` and the `PSR12.Classes.AnonClassDeclaration` sniffs to handle constructor properties preceded by docblocks correctly.

There is one functional change:
The sniffs will no longer throw a `FirstParamSpacing` error when there are blank lines between the function open parenthesis and the first parameter.
As the sniffs still throw a `EmptyLine` error in that case - and will auto-fix that error - I've deemed that acceptable as the "fixed" file will still be the same.

Fixes 3342
@fabianbadoi
Copy link

Hey,

I'm the one who openened a duplicate of #3342 (#3363, sorry about that).

I ran this branch on our 'broken' code and the rest of our code base:

  • the bug is fixed, phpdoc is now properly accepted
  • the rest of code base was fine, so probably no regressions/new bugs

Thanks for the hard work!

@jrfnl
Copy link
Contributor Author

jrfnl commented May 25, 2021

Thanks for testing @fabianbadoi !

gsherwood added a commit that referenced this pull request May 27, 2021
@gsherwood gsherwood merged commit 1f63961 into squizlabs:master May 27, 2021
@gsherwood
Copy link
Member

The sniffs will no longer throw a FirstParamSpacing error when there are blank lines between the function open parenthesis and the first parameter.

I think this is completely fine. That message is really there to stop the param starting on the same line as the opening parenthesis, and that's still working perfectly fine.

Thanks a lot for fixing this one - it's obviously annoying quite a few people.

@jrfnl jrfnl deleted the php-8.0/3342-pear-functiondeclaration-constructor-prop-prom-indent branch May 27, 2021 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PSR12/Squiz/PEAR standards all error on promoted properties with docblocks

3 participants