{"action":"created","comment":{"url":"https://api.github.com/repos/Roave/BetterReflection/pulls/comments/34739188","id":34739188,"diff_hunk":"@@ -15,51 +16,67 @@ class CompileNodeToValue\n      */\n     public function __invoke(Node $node)\n     {\n-        if ($node instanceof Node\\Scalar\\String_\n-            || $node instanceof Node\\Scalar\\DNumber\n-            || $node instanceof Node\\Scalar\\LNumber) {\n-            return $node->value;\n+        if (!$this->isCompilable($node)) {\n+            throw new Exception\\UnableToCompileNode('Unable to compile expression: ' . get_class($node));\n         }\n \n-        if ($node instanceof Node\\Expr\\Array_) {\n-            $compiledArray = [];\n-            foreach ($node->items as $arrayItem) {\n-                $compiledValue = $this->__invoke($arrayItem->value);\n-\n-                if (null == $arrayItem->key) {\n-                    $compiledArray[] = $compiledValue;\n-                    continue;\n-                }\n+        if ($node instanceof Node\\Expr\\ConstFetch) {\n+            return $this->compileConstFetch($node);\n+        }\n \n-                $compiledArray[$this->__invoke($arrayItem->key)] = $compiledValue;\n-            }\n-            return $compiledArray;\n+        if ($node instanceof Node\\Expr\\ClassConstFetch) {\n+            return $this->compileClassConstFetch($node);\n         }\n \n-        if ($node instanceof Node\\Expr\\ConstFetch) {\n-            $firstName = reset($node->name->parts);\n-            switch ($firstName) {\n-                case 'null':\n-                    return null;\n-                case 'false':\n-                    return false;\n-                case 'true':\n-                    return true;\n-                default:\n-                    // @todo this should evaluate the VALUE, not the name\n-                    /* @see https://github.com/Roave/BetterReflection/issues/19 */\n-                    return $firstName;\n-            }\n+        $printer = new Printer();\n+        $code = $printer->prettyPrint([$node]);\n+\n+        eval('$x = ' . $code);","path":"src/NodeCompiler/CompileNodeToValue.php","position":57,"original_position":57,"commit_id":"3cadedbb4c52d104888866684e7875bf847e7d97","original_commit_id":"3cadedbb4c52d104888866684e7875bf847e7d97","user":{"login":"Ocramius","id":154256,"avatar_url":"https://avatars.githubusercontent.com/u/154256?v=3","gravatar_id":"","url":"https://api.github.com/users/Ocramius","html_url":"https://github.com/Ocramius","followers_url":"https://api.github.com/users/Ocramius/followers","following_url":"https://api.github.com/users/Ocramius/following{/other_user}","gists_url":"https://api.github.com/users/Ocramius/gists{/gist_id}","starred_url":"https://api.github.com/users/Ocramius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ocramius/subscriptions","organizations_url":"https://api.github.com/users/Ocramius/orgs","repos_url":"https://api.github.com/users/Ocramius/repos","events_url":"https://api.github.com/users/Ocramius/events{/privacy}","received_events_url":"https://api.github.com/users/Ocramius/received_events","type":"User","site_admin":false},"body":"Traversal to replace such nodes should indeed happen upfront :-(","created_at":"2015-07-15T22:52:57Z","updated_at":"2015-07-15T22:52:57Z","html_url":"https://github.com/Roave/BetterReflection/pull/67#discussion_r34739188","pull_request_url":"https://api.github.com/repos/Roave/BetterReflection/pulls/67","_links":{"self":{"href":"https://api.github.com/repos/Roave/BetterReflection/pulls/comments/34739188"},"html":{"href":"https://github.com/Roave/BetterReflection/pull/67#discussion_r34739188"},"pull_request":{"href":"https://api.github.com/repos/Roave/BetterReflection/pulls/67"}}},"pull_request":{"url":"https://api.github.com/repos/Roave/BetterReflection/pulls/67","id":40073113,"html_url":"https://github.com/Roave/BetterReflection/pull/67","diff_url":"https://github.com/Roave/BetterReflection/pull/67.diff","patch_url":"https://github.com/Roave/BetterReflection/pull/67.patch","issue_url":"https://api.github.com/repos/Roave/BetterReflection/issues/67","number":67,"state":"open","locked":false,"title":"[WIP] Crazy idea lolcakes","user":{"login":"asgrim","id":496145,"avatar_url":"https://avatars.githubusercontent.com/u/496145?v=3","gravatar_id":"","url":"https://api.github.com/users/asgrim","html_url":"https://github.com/asgrim","followers_url":"https://api.github.com/users/asgrim/followers","following_url":"https://api.github.com/users/asgrim/following{/other_user}","gists_url":"https://api.github.com/users/asgrim/gists{/gist_id}","starred_url":"https://api.github.com/users/asgrim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asgrim/subscriptions","organizations_url":"https://api.github.com/users/asgrim/orgs","repos_url":"https://api.github.com/users/asgrim/repos","events_url":"https://api.github.com/users/asgrim/events{/privacy}","received_events_url":"https://api.github.com/users/asgrim/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-07-15T21:41:30Z","updated_at":"2015-07-15T22:52:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3e9f1dc0b4361ab049c68b8738e1445698a782f2","assignee":{"login":"asgrim","id":496145,"avatar_url":"https://avatars.githubusercontent.com/u/496145?v=3","gravatar_id":"","url":"https://api.github.com/users/asgrim","html_url":"https://github.com/asgrim","followers_url":"https://api.github.com/users/asgrim/followers","following_url":"https://api.github.com/users/asgrim/following{/other_user}","gists_url":"https://api.github.com/users/asgrim/gists{/gist_id}","starred_url":"https://api.github.com/users/asgrim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asgrim/subscriptions","organizations_url":"https://api.github.com/users/asgrim/orgs","repos_url":"https://api.github.com/users/asgrim/repos","events_url":"https://api.github.com/users/asgrim/events{/privacy}","received_events_url":"https://api.github.com/users/asgrim/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/Roave/BetterReflection/milestones/1","html_url":"https://github.com/Roave/BetterReflection/milestones/1.0.0","labels_url":"https://api.github.com/repos/Roave/BetterReflection/milestones/1/labels","id":1187129,"number":1,"title":"1.0.0","description":"","creator":{"login":"asgrim","id":496145,"avatar_url":"https://avatars.githubusercontent.com/u/496145?v=3","gravatar_id":"","url":"https://api.github.com/users/asgrim","html_url":"https://github.com/asgrim","followers_url":"https://api.github.com/users/asgrim/followers","following_url":"https://api.github.com/users/asgrim/following{/other_user}","gists_url":"https://api.github.com/users/asgrim/gists{/gist_id}","starred_url":"https://api.github.com/users/asgrim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asgrim/subscriptions","organizations_url":"https://api.github.com/users/asgrim/orgs","repos_url":"https://api.github.com/users/asgrim/repos","events_url":"https://api.github.com/users/asgrim/events{/privacy}","received_events_url":"https://api.github.com/users/asgrim/received_events","type":"User","site_admin":false},"open_issues":9,"closed_issues":37,"state":"open","created_at":"2015-06-30T13:57:38Z","updated_at":"2015-07-15T21:41:45Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/Roave/BetterReflection/pulls/67/commits","review_comments_url":"https://api.github.com/repos/Roave/BetterReflection/pulls/67/comments","review_comment_url":"https://api.github.com/repos/Roave/BetterReflection/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Roave/BetterReflection/issues/67/comments","statuses_url":"https://api.github.com/repos/Roave/BetterReflection/statuses/3cadedbb4c52d104888866684e7875bf847e7d97","head":{"label":"Roave:crazy-idea-lolcakes","ref":"crazy-idea-lolcakes","sha":"3cadedbb4c52d104888866684e7875bf847e7d97","user":{"login":"Roave","id":3029050,"avatar_url":"https://avatars.githubusercontent.com/u/3029050?v=3","gravatar_id":"","url":"https://api.github.com/users/Roave","html_url":"https://github.com/Roave","followers_url":"https://api.github.com/users/Roave/followers","following_url":"https://api.github.com/users/Roave/following{/other_user}","gists_url":"https://api.github.com/users/Roave/gists{/gist_id}","starred_url":"https://api.github.com/users/Roave/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Roave/subscriptions","organizations_url":"https://api.github.com/users/Roave/orgs","repos_url":"https://api.github.com/users/Roave/repos","events_url":"https://api.github.com/users/Roave/events{/privacy}","received_events_url":"https://api.github.com/users/Roave/received_events","type":"Organization","site_admin":false},"repo":{"id":36865277,"name":"BetterReflection","full_name":"Roave/BetterReflection","owner":{"login":"Roave","id":3029050,"avatar_url":"https://avatars.githubusercontent.com/u/3029050?v=3","gravatar_id":"","url":"https://api.github.com/users/Roave","html_url":"https://github.com/Roave","followers_url":"https://api.github.com/users/Roave/followers","following_url":"https://api.github.com/users/Roave/following{/other_user}","gists_url":"https://api.github.com/users/Roave/gists{/gist_id}","starred_url":"https://api.github.com/users/Roave/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Roave/subscriptions","organizations_url":"https://api.github.com/users/Roave/orgs","repos_url":"https://api.github.com/users/Roave/repos","events_url":"https://api.github.com/users/Roave/events{/privacy}","received_events_url":"https://api.github.com/users/Roave/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Roave/BetterReflection","description":"PHP's reflection API but without having to load the class","fork":false,"url":"https://api.github.com/repos/Roave/BetterReflection","forks_url":"https://api.github.com/repos/Roave/BetterReflection/forks","keys_url":"https://api.github.com/repos/Roave/BetterReflection/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Roave/BetterReflection/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Roave/BetterReflection/teams","hooks_url":"https://api.github.com/repos/Roave/BetterReflection/hooks","issue_events_url":"https://api.github.com/repos/Roave/BetterReflection/issues/events{/number}","events_url":"https://api.github.com/repos/Roave/BetterReflection/events","assignees_url":"https://api.github.com/repos/Roave/BetterReflection/assignees{/user}","branches_url":"https://api.github.com/repos/Roave/BetterReflection/branches{/branch}","tags_url":"https://api.github.com/repos/Roave/BetterReflection/tags","blobs_url":"https://api.github.com/repos/Roave/BetterReflection/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Roave/BetterReflection/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Roave/BetterReflection/git/refs{/sha}","trees_url":"https://api.github.com/repos/Roave/BetterReflection/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Roave/BetterReflection/statuses/{sha}","languages_url":"https://api.github.com/repos/Roave/BetterReflection/languages","stargazers_url":"https://api.github.com/repos/Roave/BetterReflection/stargazers","contributors_url":"https://api.github.com/repos/Roave/BetterReflection/contributors","subscribers_url":"https://api.github.com/repos/Roave/BetterReflection/subscribers","subscription_url":"https://api.github.com/repos/Roave/BetterReflection/subscription","commits_url":"https://api.github.com/repos/Roave/BetterReflection/commits{/sha}","git_commits_url":"https://api.github.com/repos/Roave/BetterReflection/git/commits{/sha}","comments_url":"https://api.github.com/repos/Roave/BetterReflection/comments{/number}","issue_comment_url":"https://api.github.com/repos/Roave/BetterReflection/issues/comments{/number}","contents_url":"https://api.github.com/repos/Roave/BetterReflection/contents/{+path}","compare_url":"https://api.github.com/repos/Roave/BetterReflection/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Roave/BetterReflection/merges","archive_url":"https://api.github.com/repos/Roave/BetterReflection/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Roave/BetterReflection/downloads","issues_url":"https://api.github.com/repos/Roave/BetterReflection/issues{/number}","pulls_url":"https://api.github.com/repos/Roave/BetterReflection/pulls{/number}","milestones_url":"https://api.github.com/repos/Roave/BetterReflection/milestones{/number}","notifications_url":"https://api.github.com/repos/Roave/BetterReflection/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Roave/BetterReflection/labels{/name}","releases_url":"https://api.github.com/repos/Roave/BetterReflection/releases{/id}","created_at":"2015-06-04T11:02:42Z","updated_at":"2015-07-15T14:05:30Z","pushed_at":"2015-07-15T21:41:30Z","git_url":"git://github.com/Roave/BetterReflection.git","ssh_url":"git@github.com:Roave/BetterReflection.git","clone_url":"https://github.com/Roave/BetterReflection.git","svn_url":"https://github.com/Roave/BetterReflection","homepage":null,"size":1077,"stargazers_count":29,"watchers_count":29,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":28,"forks":3,"open_issues":28,"watchers":29,"default_branch":"master"}},"base":{"label":"Roave:master","ref":"master","sha":"c8701d28aa4efe635fff07ceed1f0ea87e5e198e","user":{"login":"Roave","id":3029050,"avatar_url":"https://avatars.githubusercontent.com/u/3029050?v=3","gravatar_id":"","url":"https://api.github.com/users/Roave","html_url":"https://github.com/Roave","followers_url":"https://api.github.com/users/Roave/followers","following_url":"https://api.github.com/users/Roave/following{/other_user}","gists_url":"https://api.github.com/users/Roave/gists{/gist_id}","starred_url":"https://api.github.com/users/Roave/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Roave/subscriptions","organizations_url":"https://api.github.com/users/Roave/orgs","repos_url":"https://api.github.com/users/Roave/repos","events_url":"https://api.github.com/users/Roave/events{/privacy}","received_events_url":"https://api.github.com/users/Roave/received_events","type":"Organization","site_admin":false},"repo":{"id":36865277,"name":"BetterReflection","full_name":"Roave/BetterReflection","owner":{"login":"Roave","id":3029050,"avatar_url":"https://avatars.githubusercontent.com/u/3029050?v=3","gravatar_id":"","url":"https://api.github.com/users/Roave","html_url":"https://github.com/Roave","followers_url":"https://api.github.com/users/Roave/followers","following_url":"https://api.github.com/users/Roave/following{/other_user}","gists_url":"https://api.github.com/users/Roave/gists{/gist_id}","starred_url":"https://api.github.com/users/Roave/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Roave/subscriptions","organizations_url":"https://api.github.com/users/Roave/orgs","repos_url":"https://api.github.com/users/Roave/repos","events_url":"https://api.github.com/users/Roave/events{/privacy}","received_events_url":"https://api.github.com/users/Roave/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Roave/BetterReflection","description":"PHP's reflection API but without having to load the class","fork":false,"url":"https://api.github.com/repos/Roave/BetterReflection","forks_url":"https://api.github.com/repos/Roave/BetterReflection/forks","keys_url":"https://api.github.com/repos/Roave/BetterReflection/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Roave/BetterReflection/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Roave/BetterReflection/teams","hooks_url":"https://api.github.com/repos/Roave/BetterReflection/hooks","issue_events_url":"https://api.github.com/repos/Roave/BetterReflection/issues/events{/number}","events_url":"https://api.github.com/repos/Roave/BetterReflection/events","assignees_url":"https://api.github.com/repos/Roave/BetterReflection/assignees{/user}","branches_url":"https://api.github.com/repos/Roave/BetterReflection/branches{/branch}","tags_url":"https://api.github.com/repos/Roave/BetterReflection/tags","blobs_url":"https://api.github.com/repos/Roave/BetterReflection/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Roave/BetterReflection/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Roave/BetterReflection/git/refs{/sha}","trees_url":"https://api.github.com/repos/Roave/BetterReflection/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Roave/BetterReflection/statuses/{sha}","languages_url":"https://api.github.com/repos/Roave/BetterReflection/languages","stargazers_url":"https://api.github.com/repos/Roave/BetterReflection/stargazers","contributors_url":"https://api.github.com/repos/Roave/BetterReflection/contributors","subscribers_url":"https://api.github.com/repos/Roave/BetterReflection/subscribers","subscription_url":"https://api.github.com/repos/Roave/BetterReflection/subscription","commits_url":"https://api.github.com/repos/Roave/BetterReflection/commits{/sha}","git_commits_url":"https://api.github.com/repos/Roave/BetterReflection/git/commits{/sha}","comments_url":"https://api.github.com/repos/Roave/BetterReflection/comments{/number}","issue_comment_url":"https://api.github.com/repos/Roave/BetterReflection/issues/comments{/number}","contents_url":"https://api.github.com/repos/Roave/BetterReflection/contents/{+path}","compare_url":"https://api.github.com/repos/Roave/BetterReflection/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Roave/BetterReflection/merges","archive_url":"https://api.github.com/repos/Roave/BetterReflection/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Roave/BetterReflection/downloads","issues_url":"https://api.github.com/repos/Roave/BetterReflection/issues{/number}","pulls_url":"https://api.github.com/repos/Roave/BetterReflection/pulls{/number}","milestones_url":"https://api.github.com/repos/Roave/BetterReflection/milestones{/number}","notifications_url":"https://api.github.com/repos/Roave/BetterReflection/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Roave/BetterReflection/labels{/name}","releases_url":"https://api.github.com/repos/Roave/BetterReflection/releases{/id}","created_at":"2015-06-04T11:02:42Z","updated_at":"2015-07-15T14:05:30Z","pushed_at":"2015-07-15T21:41:30Z","git_url":"git://github.com/Roave/BetterReflection.git","ssh_url":"git@github.com:Roave/BetterReflection.git","clone_url":"https://github.com/Roave/BetterReflection.git","svn_url":"https://github.com/Roave/BetterReflection","homepage":null,"size":1077,"stargazers_count":29,"watchers_count":29,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":28,"forks":3,"open_issues":28,"watchers":29,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Roave/BetterReflection/pulls/67"},"html":{"href":"https://github.com/Roave/BetterReflection/pull/67"},"issue":{"href":"https://api.github.com/repos/Roave/BetterReflection/issues/67"},"comments":{"href":"https://api.github.com/repos/Roave/BetterReflection/issues/67/comments"},"review_comments":{"href":"https://api.github.com/repos/Roave/BetterReflection/pulls/67/comments"},"review_comment":{"href":"https://api.github.com/repos/Roave/BetterReflection/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Roave/BetterReflection/pulls/67/commits"},"statuses":{"href":"https://api.github.com/repos/Roave/BetterReflection/statuses/3cadedbb4c52d104888866684e7875bf847e7d97"}}}}