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

Bug #19869 PSR-2 Sniff no longer allows operator namespce in IF negations
Submitted: 2013-03-25 18:40 UTC
From: rdohms Assigned: squiz
Status: No Feedback Package: PHP_CodeSniffer (version 1.4.4)
PHP Version: Irrelevant OS:
Roadmaps: (Not assigned)    
Subscription  


 [2013-03-25 18:40 UTC] rdohms (Rafael Dohms)
Description: ------------ The statement: if ( ! $variable) { was accepted by the first versions of PRS-2 sniffs, but is now not accepted anymore. As far as I could tell there was no chance to the PSR-2 rule that forced this to be true. Is "whitespace around negation operator" triggering the "whitespace after parenthesis" rule, and if so, should this be the case?

Comments

 [2013-03-26 03:23 UTC] squiz (Greg Sherwood)
-Status: Open +Status: Feedback -Assigned To: +Assigned To: squiz
The PSR-2 sniffs receive standard receives bug fixes like everything else. This one was fixed in version 1.4.4 and reported on bug #19732 I forgot to add a sniff to check for part of the standard, as described here: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style- guide.md#5-control-structures "There MUST NOT be a space after the opening parenthesis" So everything is working correctly now, and the fact that you didn't get any errors was a PHPCS bug as the PSR-2 is pretty clear about what is required. Does that explain things?
 [2013-04-02 06:43 UTC] squiz (Greg Sherwood)
-Status: Feedback +Status: No Feedback