{"action":"created","comment":{"url":"https://api.github.com/repos/Halleck45/PhpMetrics/pulls/comments/46838491","id":46838491,"diff_hunk":"@@ -0,0 +1,100 @@\n+<?php\n+\n+/*\n+ * (c) Jean-François Lépine <https://twitter.com/Halleck45>\n+ *\n+ * For the full copyright and license information, please view the LICENSE\n+ * file that was distributed with this source code.\n+ */\n+\n+namespace Hal\\Component\\OOP\\Resolver;\n+\n+\n+/**\n+ * Type resolver\n+ *\n+ * @author Jean-François Lépine <https://twitter.com/Halleck45>\n+ */\n+class TypeResolver\n+{\n+\n+    const TYPE_VOID = 'void';\n+    const TYPE_STRING = 'string';\n+    const TYPE_INTEGER = 'integer';\n+    const TYPE_FLOAT = 'float';\n+    const TYPE_ARRAY = 'array';\n+    const TYPE_NULL = 'null';\n+    const TYPE_UNKNWON = 'unknown';\n+    const TYPE_FLUENT_INTERFACE = 'fluent';\n+\n+    /**\n+     * Resolves type of given string\n+     *\n+     * @param $string\n+     * @return string\n+     */\n+    public function resolve($string)\n+    {\n+        $string = $cased = trim($string, \";\\t\\n\\r\\0\\x0B\");\n+        $string = strtolower($string);\n+\n+        if(strlen($string) == 0) {\n+            return self::TYPE_VOID;\n+        }\n+\n+        if(preg_match('!^\\d+$!', $string)) {\n+            return self::TYPE_INTEGER;\n+        }\n+\n+        if(preg_match('!^\\d+\\.\\d+$!', $string)) {\n+            return self::TYPE_FLOAT;\n+        }\n+\n+        if('null' == $string) {\n+            return self::TYPE_NULL;\n+        }\n+\n+        if(preg_match('!(^\\[|^array\\()!', $string)) {\n+            return self::TYPE_ARRAY;\n+        }\n+\n+        if(preg_match('!(^\\[|^array\\()!', $string)) {\n+            return self::TYPE_ARRAY;\n+        }\n+\n+        if(preg_match('!^new\\s*(.*)!', $string, $matches)) {\n+            return trim(preg_replace('!^(new\\s+)!', '', $cased));","path":"src/Hal/Component/OOP/Resolver/TypeResolver.php","position":null,"original_position":66,"commit_id":"da7e0438461467ca3f981a29bbad8aa03d724957","original_commit_id":"fee3d9189d4c58dff89337336cdaa24d509e0afd","user":{"login":"Halleck45","id":1076296,"avatar_url":"https://avatars.githubusercontent.com/u/1076296?v=3","gravatar_id":"","url":"https://api.github.com/users/Halleck45","html_url":"https://github.com/Halleck45","followers_url":"https://api.github.com/users/Halleck45/followers","following_url":"https://api.github.com/users/Halleck45/following{/other_user}","gists_url":"https://api.github.com/users/Halleck45/gists{/gist_id}","starred_url":"https://api.github.com/users/Halleck45/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Halleck45/subscriptions","organizations_url":"https://api.github.com/users/Halleck45/orgs","repos_url":"https://api.github.com/users/Halleck45/repos","events_url":"https://api.github.com/users/Halleck45/events{/privacy}","received_events_url":"https://api.github.com/users/Halleck45/received_events","type":"User","site_admin":false},"body":"Thanks @stof. I hope that is fixed with [this commit](https://github.com/Halleck45/PhpMetrics/commit/da7e0438461467ca3f981a29bbad8aa03d724957)","created_at":"2015-12-07T16:07:14Z","updated_at":"2015-12-07T16:07:14Z","html_url":"https://github.com/Halleck45/PhpMetrics/pull/162#discussion_r46838491","pull_request_url":"https://api.github.com/repos/Halleck45/PhpMetrics/pulls/162","_links":{"self":{"href":"https://api.github.com/repos/Halleck45/PhpMetrics/pulls/comments/46838491"},"html":{"href":"https://github.com/Halleck45/PhpMetrics/pull/162#discussion_r46838491"},"pull_request":{"href":"https://api.github.com/repos/Halleck45/PhpMetrics/pulls/162"}}},"pull_request":{"url":"https://api.github.com/repos/Halleck45/PhpMetrics/pulls/162","id":52821250,"html_url":"https://github.com/Halleck45/PhpMetrics/pull/162","diff_url":"https://github.com/Halleck45/PhpMetrics/pull/162.diff","patch_url":"https://github.com/Halleck45/PhpMetrics/pull/162.patch","issue_url":"https://api.github.com/repos/Halleck45/PhpMetrics/issues/162","number":162,"state":"open","locked":false,"title":"Php7","user":{"login":"Halleck45","id":1076296,"avatar_url":"https://avatars.githubusercontent.com/u/1076296?v=3","gravatar_id":"","url":"https://api.github.com/users/Halleck45","html_url":"https://github.com/Halleck45","followers_url":"https://api.github.com/users/Halleck45/followers","following_url":"https://api.github.com/users/Halleck45/following{/other_user}","gists_url":"https://api.github.com/users/Halleck45/gists{/gist_id}","starred_url":"https://api.github.com/users/Halleck45/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Halleck45/subscriptions","organizations_url":"https://api.github.com/users/Halleck45/orgs","repos_url":"https://api.github.com/users/Halleck45/repos","events_url":"https://api.github.com/users/Halleck45/events{/privacy}","received_events_url":"https://api.github.com/users/Halleck45/received_events","type":"User","site_admin":false},"body":"## PHP 7\r\n+ Anonymous classes parsed\r\n+ get returned type of method\r\n+ spaceship operator\r\n+ null colaesce operator\r\n\r\n## Misc\r\n+ way to get visibility of a method\r\n+ way to get state of method\r\n+ `Searcher` improved\r\n+ introduced new `ReflectedReturn` object\r\n+ improved detection of returned values\r\n\r\n## Command\r\n+ flag `--ignore-errors` in order to ignore syntax errors (For example, if you parse PHP7 code with older version of PHP)\r\n\r\n## Metrics\r\n+ cyclomatic complexity takes care of anonymous classes\r\n+ afferent coupling takes care of anonymous classes\r\n+ report display number of anonymous classes\r\n\r\n## Fixes\r\n+ lot of bugs :)\r\n+ #160","created_at":"2015-12-07T09:25:47Z","updated_at":"2015-12-07T16:07:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5083896f5ff9b531e7cdd4fd4535d3ea5c4ae37b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Halleck45/PhpMetrics/pulls/162/commits","review_comments_url":"https://api.github.com/repos/Halleck45/PhpMetrics/pulls/162/comments","review_comment_url":"https://api.github.com/repos/Halleck45/PhpMetrics/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Halleck45/PhpMetrics/issues/162/comments","statuses_url":"https://api.github.com/repos/Halleck45/PhpMetrics/statuses/da7e0438461467ca3f981a29bbad8aa03d724957","head":{"label":"Halleck45:php7","ref":"php7","sha":"da7e0438461467ca3f981a29bbad8aa03d724957","user":{"login":"Halleck45","id":1076296,"avatar_url":"https://avatars.githubusercontent.com/u/1076296?v=3","gravatar_id":"","url":"https://api.github.com/users/Halleck45","html_url":"https://github.com/Halleck45","followers_url":"https://api.github.com/users/Halleck45/followers","following_url":"https://api.github.com/users/Halleck45/following{/other_user}","gists_url":"https://api.github.com/users/Halleck45/gists{/gist_id}","starred_url":"https://api.github.com/users/Halleck45/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Halleck45/subscriptions","organizations_url":"https://api.github.com/users/Halleck45/orgs","repos_url":"https://api.github.com/users/Halleck45/repos","events_url":"https://api.github.com/users/Halleck45/events{/privacy}","received_events_url":"https://api.github.com/users/Halleck45/received_events","type":"User","site_admin":false},"repo":{"id":15167051,"name":"PhpMetrics","full_name":"Halleck45/PhpMetrics","owner":{"login":"Halleck45","id":1076296,"avatar_url":"https://avatars.githubusercontent.com/u/1076296?v=3","gravatar_id":"","url":"https://api.github.com/users/Halleck45","html_url":"https://github.com/Halleck45","followers_url":"https://api.github.com/users/Halleck45/followers","following_url":"https://api.github.com/users/Halleck45/following{/other_user}","gists_url":"https://api.github.com/users/Halleck45/gists{/gist_id}","starred_url":"https://api.github.com/users/Halleck45/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Halleck45/subscriptions","organizations_url":"https://api.github.com/users/Halleck45/orgs","repos_url":"https://api.github.com/users/Halleck45/repos","events_url":"https://api.github.com/users/Halleck45/events{/privacy}","received_events_url":"https://api.github.com/users/Halleck45/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Halleck45/PhpMetrics","description":"Static analysis tool for PHP","fork":false,"url":"https://api.github.com/repos/Halleck45/PhpMetrics","forks_url":"https://api.github.com/repos/Halleck45/PhpMetrics/forks","keys_url":"https://api.github.com/repos/Halleck45/PhpMetrics/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Halleck45/PhpMetrics/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Halleck45/PhpMetrics/teams","hooks_url":"https://api.github.com/repos/Halleck45/PhpMetrics/hooks","issue_events_url":"https://api.github.com/repos/Halleck45/PhpMetrics/issues/events{/number}","events_url":"https://api.github.com/repos/Halleck45/PhpMetrics/events","assignees_url":"https://api.github.com/repos/Halleck45/PhpMetrics/assignees{/user}","branches_url":"https://api.github.com/repos/Halleck45/PhpMetrics/branches{/branch}","tags_url":"https://api.github.com/repos/Halleck45/PhpMetrics/tags","blobs_url":"https://api.github.com/repos/Halleck45/PhpMetrics/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Halleck45/PhpMetrics/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Halleck45/PhpMetrics/git/refs{/sha}","trees_url":"https://api.github.com/repos/Halleck45/PhpMetrics/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Halleck45/PhpMetrics/statuses/{sha}","languages_url":"https://api.github.com/repos/Halleck45/PhpMetrics/languages","stargazers_url":"https://api.github.com/repos/Halleck45/PhpMetrics/stargazers","contributors_url":"https://api.github.com/repos/Halleck45/PhpMetrics/contributors","subscribers_url":"https://api.github.com/repos/Halleck45/PhpMetrics/subscribers","subscription_url":"https://api.github.com/repos/Halleck45/PhpMetrics/subscription","commits_url":"https://api.github.com/repos/Halleck45/PhpMetrics/commits{/sha}","git_commits_url":"https://api.github.com/repos/Halleck45/PhpMetrics/git/commits{/sha}","comments_url":"https://api.github.com/repos/Halleck45/PhpMetrics/comments{/number}","issue_comment_url":"https://api.github.com/repos/Halleck45/PhpMetrics/issues/comments{/number}","contents_url":"https://api.github.com/repos/Halleck45/PhpMetrics/contents/{+path}","compare_url":"https://api.github.com/repos/Halleck45/PhpMetrics/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Halleck45/PhpMetrics/merges","archive_url":"https://api.github.com/repos/Halleck45/PhpMetrics/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Halleck45/PhpMetrics/downloads","issues_url":"https://api.github.com/repos/Halleck45/PhpMetrics/issues{/number}","pulls_url":"https://api.github.com/repos/Halleck45/PhpMetrics/pulls{/number}","milestones_url":"https://api.github.com/repos/Halleck45/PhpMetrics/milestones{/number}","notifications_url":"https://api.github.com/repos/Halleck45/PhpMetrics/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Halleck45/PhpMetrics/labels{/name}","releases_url":"https://api.github.com/repos/Halleck45/PhpMetrics/releases{/id}","created_at":"2013-12-13T15:31:43Z","updated_at":"2015-12-07T13:36:43Z","pushed_at":"2015-12-07T16:06:12Z","git_url":"git://github.com/Halleck45/PhpMetrics.git","ssh_url":"git@github.com:Halleck45/PhpMetrics.git","clone_url":"https://github.com/Halleck45/PhpMetrics.git","svn_url":"https://github.com/Halleck45/PhpMetrics","homepage":"http://www.phpmetrics.org/","size":12046,"stargazers_count":681,"watchers_count":681,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":73,"mirror_url":null,"open_issues_count":8,"forks":73,"open_issues":8,"watchers":681,"default_branch":"master"}},"base":{"label":"Halleck45:master","ref":"master","sha":"4342821e37dbc1143d573cf8ccea25a72971b611","user":{"login":"Halleck45","id":1076296,"avatar_url":"https://avatars.githubusercontent.com/u/1076296?v=3","gravatar_id":"","url":"https://api.github.com/users/Halleck45","html_url":"https://github.com/Halleck45","followers_url":"https://api.github.com/users/Halleck45/followers","following_url":"https://api.github.com/users/Halleck45/following{/other_user}","gists_url":"https://api.github.com/users/Halleck45/gists{/gist_id}","starred_url":"https://api.github.com/users/Halleck45/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Halleck45/subscriptions","organizations_url":"https://api.github.com/users/Halleck45/orgs","repos_url":"https://api.github.com/users/Halleck45/repos","events_url":"https://api.github.com/users/Halleck45/events{/privacy}","received_events_url":"https://api.github.com/users/Halleck45/received_events","type":"User","site_admin":false},"repo":{"id":15167051,"name":"PhpMetrics","full_name":"Halleck45/PhpMetrics","owner":{"login":"Halleck45","id":1076296,"avatar_url":"https://avatars.githubusercontent.com/u/1076296?v=3","gravatar_id":"","url":"https://api.github.com/users/Halleck45","html_url":"https://github.com/Halleck45","followers_url":"https://api.github.com/users/Halleck45/followers","following_url":"https://api.github.com/users/Halleck45/following{/other_user}","gists_url":"https://api.github.com/users/Halleck45/gists{/gist_id}","starred_url":"https://api.github.com/users/Halleck45/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Halleck45/subscriptions","organizations_url":"https://api.github.com/users/Halleck45/orgs","repos_url":"https://api.github.com/users/Halleck45/repos","events_url":"https://api.github.com/users/Halleck45/events{/privacy}","received_events_url":"https://api.github.com/users/Halleck45/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Halleck45/PhpMetrics","description":"Static analysis tool for PHP","fork":false,"url":"https://api.github.com/repos/Halleck45/PhpMetrics","forks_url":"https://api.github.com/repos/Halleck45/PhpMetrics/forks","keys_url":"https://api.github.com/repos/Halleck45/PhpMetrics/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Halleck45/PhpMetrics/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Halleck45/PhpMetrics/teams","hooks_url":"https://api.github.com/repos/Halleck45/PhpMetrics/hooks","issue_events_url":"https://api.github.com/repos/Halleck45/PhpMetrics/issues/events{/number}","events_url":"https://api.github.com/repos/Halleck45/PhpMetrics/events","assignees_url":"https://api.github.com/repos/Halleck45/PhpMetrics/assignees{/user}","branches_url":"https://api.github.com/repos/Halleck45/PhpMetrics/branches{/branch}","tags_url":"https://api.github.com/repos/Halleck45/PhpMetrics/tags","blobs_url":"https://api.github.com/repos/Halleck45/PhpMetrics/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Halleck45/PhpMetrics/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Halleck45/PhpMetrics/git/refs{/sha}","trees_url":"https://api.github.com/repos/Halleck45/PhpMetrics/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Halleck45/PhpMetrics/statuses/{sha}","languages_url":"https://api.github.com/repos/Halleck45/PhpMetrics/languages","stargazers_url":"https://api.github.com/repos/Halleck45/PhpMetrics/stargazers","contributors_url":"https://api.github.com/repos/Halleck45/PhpMetrics/contributors","subscribers_url":"https://api.github.com/repos/Halleck45/PhpMetrics/subscribers","subscription_url":"https://api.github.com/repos/Halleck45/PhpMetrics/subscription","commits_url":"https://api.github.com/repos/Halleck45/PhpMetrics/commits{/sha}","git_commits_url":"https://api.github.com/repos/Halleck45/PhpMetrics/git/commits{/sha}","comments_url":"https://api.github.com/repos/Halleck45/PhpMetrics/comments{/number}","issue_comment_url":"https://api.github.com/repos/Halleck45/PhpMetrics/issues/comments{/number}","contents_url":"https://api.github.com/repos/Halleck45/PhpMetrics/contents/{+path}","compare_url":"https://api.github.com/repos/Halleck45/PhpMetrics/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Halleck45/PhpMetrics/merges","archive_url":"https://api.github.com/repos/Halleck45/PhpMetrics/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Halleck45/PhpMetrics/downloads","issues_url":"https://api.github.com/repos/Halleck45/PhpMetrics/issues{/number}","pulls_url":"https://api.github.com/repos/Halleck45/PhpMetrics/pulls{/number}","milestones_url":"https://api.github.com/repos/Halleck45/PhpMetrics/milestones{/number}","notifications_url":"https://api.github.com/repos/Halleck45/PhpMetrics/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Halleck45/PhpMetrics/labels{/name}","releases_url":"https://api.github.com/repos/Halleck45/PhpMetrics/releases{/id}","created_at":"2013-12-13T15:31:43Z","updated_at":"2015-12-07T13:36:43Z","pushed_at":"2015-12-07T16:06:12Z","git_url":"git://github.com/Halleck45/PhpMetrics.git","ssh_url":"git@github.com:Halleck45/PhpMetrics.git","clone_url":"https://github.com/Halleck45/PhpMetrics.git","svn_url":"https://github.com/Halleck45/PhpMetrics","homepage":"http://www.phpmetrics.org/","size":12046,"stargazers_count":681,"watchers_count":681,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":73,"mirror_url":null,"open_issues_count":8,"forks":73,"open_issues":8,"watchers":681,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Halleck45/PhpMetrics/pulls/162"},"html":{"href":"https://github.com/Halleck45/PhpMetrics/pull/162"},"issue":{"href":"https://api.github.com/repos/Halleck45/PhpMetrics/issues/162"},"comments":{"href":"https://api.github.com/repos/Halleck45/PhpMetrics/issues/162/comments"},"review_comments":{"href":"https://api.github.com/repos/Halleck45/PhpMetrics/pulls/162/comments"},"review_comment":{"href":"https://api.github.com/repos/Halleck45/PhpMetrics/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Halleck45/PhpMetrics/pulls/162/commits"},"statuses":{"href":"https://api.github.com/repos/Halleck45/PhpMetrics/statuses/da7e0438461467ca3f981a29bbad8aa03d724957"}}}}