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

Bug #19755 Token of T_CLASS type has no scope_opener and scope_closer keys.
Submitted: 2012-12-17 16:25 UTC
From: awakehl Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version 1.4.3)
PHP Version: 5.3.6 OS: ubuntu 11.10
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 : 39 - 23 = ?

 
 [2012-12-17 16:25 UTC] awakehl (simon ta)
Description: ------------ Just upgraded from 1.3.3 to 1.4.3 and now have errors with some of my class files. Something like Notice: Undefined index: scope_closer in ../Sniffs/WhiteSpace/FunctionSpacingSniff.php on line 38. There is no scope_closer and scope_opener keys in T_CLASS type token. Test script: --------------- This error reproducing when i'm trying to check this file: <?php class Test { public function test() { if (1) 1; 1 ? (1 ? 1 : 1) : 1; } } Expected result: ---------------- Expected scope_closer and scope_opener keys in token. Actual result: -------------- No scope_closer and scope_opener keys in token. Got php Notice in my sniff.

Comments

 [2012-12-19 05:46 UTC] squiz (Greg Sherwood)
-Assigned To: +Assigned To: squiz
This is caused by the fact that the first IF statement has no openers or closers of any kind, and the second has no keyword. So the tokenizer matches the keyword on the first line of the function with the opener on the second.
 [2012-12-19 05:53 UTC] squiz (Greg Sherwood)
-Status: Assigned +Status: Closed
Fix committed to github repo: https://github.com/squizlabs/PHP_CodeSniffer/commit/18245dc94cb109937d3a29cc79 dd2a9684ad3549