{"action":"created","issue":{"url":"https://api.github.com/repos/squizlabs/PHP_CodeSniffer/issues/770","labels_url":"https://api.github.com/repos/squizlabs/PHP_CodeSniffer/issues/770/labels{/name}","comments_url":"https://api.github.com/repos/squizlabs/PHP_CodeSniffer/issues/770/comments","events_url":"https://api.github.com/repos/squizlabs/PHP_CodeSniffer/issues/770/events","html_url":"https://github.com/squizlabs/PHP_CodeSniffer/issues/770","id":117179946,"number":770,"title":"False positive in closing brackets of anonymous functions","user":{"login":"JulienPalard","id":239510,"avatar_url":"https://avatars.githubusercontent.com/u/239510?v=3","gravatar_id":"","url":"https://api.github.com/users/JulienPalard","html_url":"https://github.com/JulienPalard","followers_url":"https://api.github.com/users/JulienPalard/followers","following_url":"https://api.github.com/users/JulienPalard/following{/other_user}","gists_url":"https://api.github.com/users/JulienPalard/gists{/gist_id}","starred_url":"https://api.github.com/users/JulienPalard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JulienPalard/subscriptions","organizations_url":"https://api.github.com/users/JulienPalard/orgs","repos_url":"https://api.github.com/users/JulienPalard/repos","events_url":"https://api.github.com/users/JulienPalard/events{/privacy}","received_events_url":"https://api.github.com/users/JulienPalard/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/squizlabs/PHP_CodeSniffer/labels/Awaiting%20Feedback","name":"Awaiting Feedback","color":"207de5"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-11-16T17:43:20Z","updated_at":"2015-11-23T14:14:50Z","closed_at":null,"body":"In the following code:\r\n\r\n```\r\nfunction bar()\r\n{\r\n    $foo = function()\r\n           {\r\n               return 42;\r\n           };\r\n    return $foo();\r\n}\r\n```\r\n\r\nAt the `};` line, I'm getting:\r\n\r\n```\r\nClosing brace indented incorrectly; expected 4 spaces, found 11 [Squiz.WhiteSpace.ScopeClosingBrace.Indent]                                                                                    \r\n                                                                                                                                                                                               \r\nClosing brace indented incorrectly; expected 4 spaces, found 11 [PEAR.WhiteSpace.ScopeClosingBrace.Indent]                                                                                    \r\n```\r\n\r\nThe consistency, though, is nice :-)\r\n\r\nYet this one passes nicely:\r\n\r\n```\r\nfunction bar($baz)\r\n{\r\n    $foo = map(\r\n        function($item)\r\n        {\r\n            return $item;\r\n        }, $baz);\r\n    return $foo;\r\n}\r\n```\r\n\r\nand this one, too:\r\n\r\n```\r\nfunction bar($baz)\r\n{\r\n    $foo = map($baz,\r\n               function($item)\r\n               {\r\n                   return $item;\r\n               });\r\n    return $foo;\r\n}\r\n```\r\n\r\nThis one too:\r\n\r\n```\r\nfunction bar($baz)\r\n{\r\n    $foo = items(map($baz,\r\n                     function($item)\r\n                     {\r\n                         return $item;\r\n                     }));\r\n    return $foo;\r\n}\r\n```\r\n\r\nBut not this one:\r\n\r\n```\r\nfunction bar($baz)\r\n{\r\n    $foo = items(map(function($item)\r\n                     {\r\n                         return $item;\r\n                     }));\r\n    return $foo;\r\n}\r\n```\r\n\r\ngiving :\r\n\r\n```\r\nClosing brace indented incorrectly; expected 4 spaces, found 21 [Squiz.WhiteSpace.ScopeClosingBrace.Indent]                                                                                    \r\n                                                                                                                                                                                               \r\nClosing brace indented incorrectly; expected 4 spaces, found 21 [PEAR.WhiteSpace.ScopeClosingBrace.Indent]                                                                                    \r\n```\r\n\r\nat the first char of the `}));` line."},"comment":{"url":"https://api.github.com/repos/squizlabs/PHP_CodeSniffer/issues/comments/158942361","html_url":"https://github.com/squizlabs/PHP_CodeSniffer/issues/770#issuecomment-158942361","issue_url":"https://api.github.com/repos/squizlabs/PHP_CodeSniffer/issues/770","id":158942361,"user":{"login":"JulienPalard","id":239510,"avatar_url":"https://avatars.githubusercontent.com/u/239510?v=3","gravatar_id":"","url":"https://api.github.com/users/JulienPalard","html_url":"https://github.com/JulienPalard","followers_url":"https://api.github.com/users/JulienPalard/followers","following_url":"https://api.github.com/users/JulienPalard/following{/other_user}","gists_url":"https://api.github.com/users/JulienPalard/gists{/gist_id}","starred_url":"https://api.github.com/users/JulienPalard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JulienPalard/subscriptions","organizations_url":"https://api.github.com/users/JulienPalard/orgs","repos_url":"https://api.github.com/users/JulienPalard/repos","events_url":"https://api.github.com/users/JulienPalard/events{/privacy}","received_events_url":"https://api.github.com/users/JulienPalard/received_events","type":"User","site_admin":false},"created_at":"2015-11-23T14:14:49Z","updated_at":"2015-11-23T14:14:49Z","body":"OK I got the rule and it make sense now. I'm trying it in my code, and I can get all lambda expressions to stop whining without uglifying my code, know that I got the rule.\r\n\r\nStill, I think, less than before (it's still immature in my brain) that phpcs should accept aligning the `}` with the `{` and / or the `function`, like this:\r\n\r\n```\r\n    $foo = items(map(function($item)\r\n                     {\r\n                         return $item;\r\n                     }));\r\n```\r\n\r\nBTW thanks for your clear reply :)"}}