{"action":"created","issue":{"url":"https://api.github.com/repos/squizlabs/PHP_CodeSniffer/issues/497","labels_url":"https://api.github.com/repos/squizlabs/PHP_CodeSniffer/issues/497/labels{/name}","comments_url":"https://api.github.com/repos/squizlabs/PHP_CodeSniffer/issues/497/comments","events_url":"https://api.github.com/repos/squizlabs/PHP_CodeSniffer/issues/497/events","html_url":"https://github.com/squizlabs/PHP_CodeSniffer/issues/497","id":58237220,"number":497,"title":"Generic InlineControlStructureSniff does not support alternative SWITCH syntax","user":{"login":"pmamat","id":294254,"avatar_url":"https://avatars.githubusercontent.com/u/294254?v=3","gravatar_id":"","url":"https://api.github.com/users/pmamat","html_url":"https://github.com/pmamat","followers_url":"https://api.github.com/users/pmamat/followers","following_url":"https://api.github.com/users/pmamat/following{/other_user}","gists_url":"https://api.github.com/users/pmamat/gists{/gist_id}","starred_url":"https://api.github.com/users/pmamat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pmamat/subscriptions","organizations_url":"https://api.github.com/users/pmamat/orgs","repos_url":"https://api.github.com/users/pmamat/repos","events_url":"https://api.github.com/users/pmamat/events{/privacy}","received_events_url":"https://api.github.com/users/pmamat/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/squizlabs/PHP_CodeSniffer/labels/Bug","name":"Bug","color":"e11d21"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-02-19T17:05:06Z","updated_at":"2015-02-25T03:11:51Z","closed_at":"2015-02-25T03:11:51Z","body":"test.phtml: (it's a Zend view script / template)\r\n```\r\n<?php \r\nswitch ($this->error):\r\n\tcase Shop_Customer :: ERROR_INVALID_GENDER: ?>\r\n\t\tUng&uuml;ltiges Geschlecht!\r\n\t<?php break;\r\n\tcase Shop_Customer :: ERROR_EMAIL_IN_USE: ?>\r\n\t\tDie eingetragene E-Mail-Adresse ist bereits registriert.\r\n\t<?php break;\r\nendswitch;\r\n?>\r\n\r\n```\r\n\r\nphpcs.xml:\r\n```\r\n<?xml version=\"1.0\"?>\r\n<ruleset>\r\n\t<description>Test coding standard</description>\r\n\r\n\t<file>test.phtml</file>\r\n\r\n\t<arg name=\"extensions\" value=\"php,phtml\" />\r\n\r\n\t<arg name=\"tab-width\" value=\"4\"/>\r\n\t<arg name=\"encoding\" value=\"utf-8\"/>\r\n\r\n\r\n\t<arg name=\"report\" value=\"full\"/>\r\n\r\n\t<arg value=\"np\"/>\r\n\r\n\t<rule ref=\"Generic.ControlStructures.InlineControlStructure\" />\r\n\r\n</ruleset>\r\n```\r\n\r\nOutput:\r\n```\r\n----------------------------------------------------------------------\r\nFOUND 1 ERROR AFFECTING 1 LINE\r\n----------------------------------------------------------------------\r\n 2 | ERROR | [x] Inline control structures are not allowed\r\n----------------------------------------------------------------------\r\nPHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY\r\n----------------------------------------------------------------------\r\n```\r\n\r\nThe BIG problem is that after running `phpcbf` the code is broken:\r\ntest.phtml: (after repair attempt)\r\n```\r\n<?php \r\nswitch ($this->error) { :\r\n\tcase Shop_Customer :: ERROR_INVALID_GENDER: ?>\r\n\t\tUng&uuml;ltiges Geschlecht!\r\n\t<?php break };\r\n\tcase Shop_Customer :: ERROR_EMAIL_IN_USE: ?>\r\n\t\tDie eingetragene E-Mail-Adresse ist bereits registriert.\r\n\t<?php break;\r\nendswitch;\r\n?>\r\n```\r\nNow there are wrong brackets:\r\n```\r\nParse error: syntax error, unexpected ':', expecting case (T_CASE) or default (T_DEFAULT) or '}' in test.phtml on line 2\r\nErrors parsing test.phtml\r\n```\r\n\r\n\r\nHope you can reproduce this."},"comment":{"url":"https://api.github.com/repos/squizlabs/PHP_CodeSniffer/issues/comments/75897995","html_url":"https://github.com/squizlabs/PHP_CodeSniffer/issues/497#issuecomment-75897995","issue_url":"https://api.github.com/repos/squizlabs/PHP_CodeSniffer/issues/497","id":75897995,"user":{"login":"gsherwood","id":185976,"avatar_url":"https://avatars.githubusercontent.com/u/185976?v=3","gravatar_id":"","url":"https://api.github.com/users/gsherwood","html_url":"https://github.com/gsherwood","followers_url":"https://api.github.com/users/gsherwood/followers","following_url":"https://api.github.com/users/gsherwood/following{/other_user}","gists_url":"https://api.github.com/users/gsherwood/gists{/gist_id}","starred_url":"https://api.github.com/users/gsherwood/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gsherwood/subscriptions","organizations_url":"https://api.github.com/users/gsherwood/orgs","repos_url":"https://api.github.com/users/gsherwood/repos","events_url":"https://api.github.com/users/gsherwood/events{/privacy}","received_events_url":"https://api.github.com/users/gsherwood/received_events","type":"User","site_admin":false},"created_at":"2015-02-25T03:11:51Z","updated_at":"2015-02-25T03:11:51Z","body":"Thanks for the report and sample code. The problem was actually with the core tokenizer not supporting the alternate syntax for SWITCH, although it did for other control structures. This is fixed now."}}