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

Bug #19726 Wrong number of spaces expected after instanceof static
Submitted: 2012-11-29 15:39 UTC Modified: 2012-12-03 00:23 UTC
From: bmorel Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version 1.4.2)
PHP Version: 5.4.7 OS: CentOS
Roadmaps: (Not assigned)    
Subscription  


 [2012-11-29 15:39 UTC] bmorel (Benjamin Morel)
Description: ------------ When 'static' is used after 'instanceof', it is thought to be a static variable declaration, and wrongly expects a space after it. Test script: --------------- if ($geometry instanceof static) {} Expected result: ---------------- No errors Actual result: -------------- ERROR | Scope keyword "static" must be followed by a single space

Comments

 [2012-11-29 15:41 UTC] bmorel (Benjamin Morel)
I forgot the most important: this is when using the PSR2 standard.
 [2012-12-03 00:23 UTC] squiz (Greg Sherwood)
-Status: Open +Status: Closed -Assigned To: +Assigned To: squiz
That was a strange one. PHP was tokenizing that class name as a T_STATIC token. I changed the PHPCS tokenizer to correct it back to T_STRING. Commit is here: https://github.com/squizlabs/PHP_CodeSniffer/commit/2fc7017e28fd5285deca84b818f 6ba1ff732a785