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

Bug #19726 Wrong number of spaces expected after instanceof static
Submitted: 2012-11-29 20:39 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  
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 : 17 + 15 = ?

 
 [2012-11-29 20: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 20:41 UTC] bmorel (Benjamin Morel)
I forgot the most important: this is when using the PSR2 standard.
 [2012-12-03 05: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