Php_codesniffer: PSR2 no empty lines between functions

Created on 12 Nov 2018  路  3Comments  路  Source: squizlabs/PHP_CodeSniffer

Hello,

I tried to create a PR to guzzle to use codesniffer in order to apply PSR2

I am not sure if this is an issue or not but if you check this you will notice that there is no empty line between those two functions. I also checked the current master version. I could not find any fix.

Is this correct?

According to the examples in the PSR-2 there is an empty line between two functions

Question

All 3 comments

Yes, this is expected.

There is nothing in PSR-2 that specifies how many lines should be between functions, so I can't enforce any rule here with the built-in PSR2 standard. The examples shown cannot be used to infer a rule unless the text explicitly states something like "spacing between functions".

@gsherwood Do we have, or will, a Sniff to force these lines between functions?

@carusogabriel The Squiz.WhiteSpace.FunctionSpacing sniff can enforce whether or not to have blank lines between functions and you can configure how many lines you want.

Was this page helpful?
0 / 5 - 0 ratings