Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 3.6.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)    

 [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


 [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: 6ba1ff732a785