{"action":"created","issue":{"url":"https://api.github.com/repos/ircmaxell/php-cfg/issues/14","repository_url":"https://api.github.com/repos/ircmaxell/php-cfg","labels_url":"https://api.github.com/repos/ircmaxell/php-cfg/issues/14/labels{/name}","comments_url":"https://api.github.com/repos/ircmaxell/php-cfg/issues/14/comments","events_url":"https://api.github.com/repos/ircmaxell/php-cfg/issues/14/events","html_url":"https://github.com/ircmaxell/php-cfg/issues/14","id":140974658,"number":14,"title":"Assertion fail when returning an anonymous function.","user":{"login":"quanyang","id":7552645,"avatar_url":"https://avatars.githubusercontent.com/u/7552645?v=3","gravatar_id":"","url":"https://api.github.com/users/quanyang","html_url":"https://github.com/quanyang","followers_url":"https://api.github.com/users/quanyang/followers","following_url":"https://api.github.com/users/quanyang/following{/other_user}","gists_url":"https://api.github.com/users/quanyang/gists{/gist_id}","starred_url":"https://api.github.com/users/quanyang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/quanyang/subscriptions","organizations_url":"https://api.github.com/users/quanyang/orgs","repos_url":"https://api.github.com/users/quanyang/repos","events_url":"https://api.github.com/users/quanyang/events{/privacy}","received_events_url":"https://api.github.com/users/quanyang/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-03-15T13:38:49Z","updated_at":"2016-03-15T15:23:26Z","closed_at":null,"body":"In the following code example, an anonymous function is returned, acting like a closure. However, the Printer class expects a function name.\r\n\r\n```\r\nfunction generateComparisonFunctionForKey($key) {\r\n        return function ($left, $right) use ($key) {\r\n            if ($left[$key] == $right[$key])\r\n                return 0;\r\n            else\r\n                return ($left[$key] < $right[$key]) ? -1 : 1;\r\n        };\r\n    }\r\n```\r\n\r\nError:\r\n```\r\nWarning: assert(): Assertion failed in /Users/<redacted>/php-cfg/lib/PHPCfg/Printer.php on line 46\r\n```"},"comment":{"url":"https://api.github.com/repos/ircmaxell/php-cfg/issues/comments/196875077","html_url":"https://github.com/ircmaxell/php-cfg/issues/14#issuecomment-196875077","issue_url":"https://api.github.com/repos/ircmaxell/php-cfg/issues/14","id":196875077,"user":{"login":"nikic","id":216080,"avatar_url":"https://avatars.githubusercontent.com/u/216080?v=3","gravatar_id":"","url":"https://api.github.com/users/nikic","html_url":"https://github.com/nikic","followers_url":"https://api.github.com/users/nikic/followers","following_url":"https://api.github.com/users/nikic/following{/other_user}","gists_url":"https://api.github.com/users/nikic/gists{/gist_id}","starred_url":"https://api.github.com/users/nikic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nikic/subscriptions","organizations_url":"https://api.github.com/users/nikic/orgs","repos_url":"https://api.github.com/users/nikic/repos","events_url":"https://api.github.com/users/nikic/events{/privacy}","received_events_url":"https://api.github.com/users/nikic/received_events","type":"User","site_admin":false},"created_at":"2016-03-15T15:23:26Z","updated_at":"2016-03-15T15:23:26Z","body":"The assertion error is fixed by https://github.com/ircmaxell/php-cfg/commit/d43ed9f52f320cabf025a82b622bae9ecc48e483.\r\n\r\nHowever the way we handle bound closure variables currently is not good (and for the reference case outright violates SSA). Closure body also shouldn't be part of the same CFG really..."}}