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

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)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 19 + 28 = ?

 
 [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.

Comments

 [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: https://github.com/squizlabs/PHP_CodeSniffer/commit/3415069b960dd50fbd0f629c 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.