Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 3.7.1

Request #20241 Sniff MemberVarSpacing.After sniffs spacing before var
Submitted: 2014-04-10 22:20 UTC
From: brodkin Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version 1.5.2)
PHP Version: 5.5.10 OS: Mac OS 10.9.2
Roadmaps: (Not assigned)    

 [2014-04-10 22:20 UTC] brodkin (Ryan Brodkin)
Description: ------------ Sniff Squiz.WhiteSpace.MemberVarSpacing.After reports errors when spacing *before* a var declaration is incorrect. Sniff should be renamed or broken up into multiple sniffs. Test script: --------------- class OAuthClient extends Models { /** * The database table used by the model. * * @var string */ protected $table = 'oauth_clients'; /** * Set guarded fields. * * @var array */ protected $guarded = []; } Expected result: ---------------- Sniff should pass since the spacing between the member vars is correct. Actual result: -------------- Sniff fails due to a lack of newline between the class declaration and the first member var.


 [2014-04-29 10:45 UTC] squiz (Greg Sherwood)
-Status: Open +Status: Closed -Assigned To: +Assigned To: squiz
The sniff only does one thing; checks that there is 1 blank line before each member var. So it can't be broken out into multiple sniffs. I have changed to code to reflect what it is actually doing here: b91f1971930d6985 Also, your test code should not pass this sniff because there is no blank line between the class open brace and the start of the member var comment. Again, this sniff only checks that one thing, so you will need to exclude the sniff from your standard if you don't want that check.