{"action":"created","issue":{"url":"https://api.github.com/repos/squizlabs/PHP_CodeSniffer/issues/461","labels_url":"https://api.github.com/repos/squizlabs/PHP_CodeSniffer/issues/461/labels{/name}","comments_url":"https://api.github.com/repos/squizlabs/PHP_CodeSniffer/issues/461/comments","events_url":"https://api.github.com/repos/squizlabs/PHP_CodeSniffer/issues/461/events","html_url":"https://github.com/squizlabs/PHP_CodeSniffer/issues/461","id":55531696,"number":461,"title":"PSR2: Multiline foreach","user":{"login":"Pittiplatsch","id":3923828,"avatar_url":"https://avatars.githubusercontent.com/u/3923828?v=3","gravatar_id":"","url":"https://api.github.com/users/Pittiplatsch","html_url":"https://github.com/Pittiplatsch","followers_url":"https://api.github.com/users/Pittiplatsch/followers","following_url":"https://api.github.com/users/Pittiplatsch/following{/other_user}","gists_url":"https://api.github.com/users/Pittiplatsch/gists{/gist_id}","starred_url":"https://api.github.com/users/Pittiplatsch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Pittiplatsch/subscriptions","organizations_url":"https://api.github.com/users/Pittiplatsch/orgs","repos_url":"https://api.github.com/users/Pittiplatsch/repos","events_url":"https://api.github.com/users/Pittiplatsch/events{/privacy}","received_events_url":"https://api.github.com/users/Pittiplatsch/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-01-26T20:17:32Z","updated_at":"2015-06-19T23:46:39Z","closed_at":"2015-06-19T23:46:39Z","body":"Similar to #460, code like\r\n```\r\nforeach (\r\n    [\r\n        'foo'           => 'bar',\r\n        'foobaz'        => 'bazzy',\r\n    ] as $key => $value\r\n) {\r\n}\r\n```\r\nis ok for PSR2,\r\nand I tend to believe that even\r\n```\r\nforeach (\r\n    [\r\n        'foo'           => 'bar',\r\n        'foobaz'        => 'bazzy',\r\n    ]\r\n    as $key => $value\r\n) {\r\n}\r\n```\r\nis allowed.\r\n\r\nBoth versions however throw multiple errors, complaining mostly about spare spaces."},"comment":{"url":"https://api.github.com/repos/squizlabs/PHP_CodeSniffer/issues/comments/113674095","html_url":"https://github.com/squizlabs/PHP_CodeSniffer/issues/461#issuecomment-113674095","issue_url":"https://api.github.com/repos/squizlabs/PHP_CodeSniffer/issues/461","id":113674095,"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-06-19T23:46:39Z","updated_at":"2015-06-19T23:46:39Z","body":"> The example code is just that - an example - not an exhaustive list of possible permutations I think.\r\n\r\nIn the complete absence of any words, the example code is all I have to go off. All the example code in the control structure sections follows the same general style, so this is the style PSR-2 defines and is the style PHPCS tries to enforce.\r\n\r\nFor a comment about how relaxing all the rules defeats the purpose of the coding standard all together, read this: https://github.com/squizlabs/PHP_CodeSniffer/issues/460#issuecomment-94321594"}}