{"action":"created","comment":{"url":"https://api.github.com/repos/rstgroup/object-builder/pulls/comments/210619542","pull_request_review_id":146861256,"id":210619542,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxMDYxOTU0Mg==","diff_hunk":"@@ -0,0 +1,159 @@\n+<?php declare(strict_types = 1);\n+\n+namespace RstGroup\\ObjectBuilder\\PhpDocParser;\n+\n+use PhpParser\\Node\\Stmt;\n+use PhpParser\\Parser;\n+use PHPStan\\PhpDocParser\\Lexer\\Lexer;\n+use PHPStan\\PhpDocParser\\Parser\\PhpDocParser as PhpStanPhpDocParser;\n+use PHPStan\\PhpDocParser\\Parser\\TokenIterator;\n+use ReflectionClass;\n+use ReflectionParameter;\n+use RstGroup\\ObjectBuilder\\BuildingError;\n+use RstGroup\\ObjectBuilder\\PhpDocParser;\n+\n+final class PhpStan implements PhpDocParser\n+{\n+    /** @var PhpStanPhpDocParser */\n+    private $phpDocParser;\n+    /** @var Parser */\n+    private $phpParser;\n+\n+    /** @codeCoverageIgnore */\n+    public function __construct(\n+        PhpStanPhpDocParser $phpDocParser,\n+        Parser $phpParser\n+    ) {\n+        $this->phpDocParser = $phpDocParser;\n+        $this->phpParser = $phpParser;\n+    }\n+\n+    public function isListOfObject(string $comment, string $parameterName): bool\n+    {\n+        $node = $this->phpDocParser->parse(new TokenIterator((new Lexer())->tokenize($comment)));\n+\n+        foreach ($node->getParamTagValues() as $node) {\n+            if ('$' . $parameterName === $node->parameterName) {\n+                $typeName = $node->type->type->name;\n+                if ($this->isScalar($typeName)) {\n+                    continue;\n+                }\n+\n+                return true;\n+            }\n+        }\n+\n+        return false;\n+    }\n+\n+    public function getListType(string $comment, ReflectionParameter $parameter): string\n+    {\n+        $node = $this->phpDocParser->parse(new TokenIterator((new Lexer())->tokenize($comment)));\n+\n+        foreach ($node->getParamTagValues() as $node) {\n+            if ($node->parameterName === '$' . $parameter->getName()) {\n+                $type = $node->type->type;\n+\n+                /** @var ReflectionClass $class */\n+                $class = $parameter->getDeclaringClass();\n+                /** @var string $fileName */\n+                $fileName = $class->getFileName();\n+                /** @var string $phpFileContent */\n+                $phpFileContent = file_get_contents($fileName);\n+                /** @var Stmt[] $parsedFile */\n+                $parsedFile = $this->phpParser->parse($phpFileContent);\n+\n+                $namespace = $this->getNamespaceStmt($parsedFile);\n+                $uses = $this->getUseStmts($namespace);\n+                $namespaces = $this->getUsesNamespaces($uses);\n+\n+                return $this->getFullClassName($type->name, $namespaces, $class);\n+            }\n+        }\n+\n+        throw new BuildingError();\n+    }\n+\n+    private function isScalar(string $value): bool\n+    {\n+        $scalars = [\n+            'string',\n+            'bool',\n+            'int',\n+            'float',\n+            'double',\n+            'mixed',","path":"src/PhpDocParser/PhpStan.php","position":85,"original_position":85,"commit_id":"73aa8d2e2ac1f5762a83a9db4177fec651e6a36a","original_commit_id":"73aa8d2e2ac1f5762a83a9db4177fec651e6a36a","user":{"login":"snapshotpl","id":312655,"node_id":"MDQ6VXNlcjMxMjY1NQ==","avatar_url":"https://avatars3.githubusercontent.com/u/312655?v=4","gravatar_id":"","url":"https://api.github.com/users/snapshotpl","html_url":"https://github.com/snapshotpl","followers_url":"https://api.github.com/users/snapshotpl/followers","following_url":"https://api.github.com/users/snapshotpl/following{/other_user}","gists_url":"https://api.github.com/users/snapshotpl/gists{/gist_id}","starred_url":"https://api.github.com/users/snapshotpl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snapshotpl/subscriptions","organizations_url":"https://api.github.com/users/snapshotpl/orgs","repos_url":"https://api.github.com/users/snapshotpl/repos","events_url":"https://api.github.com/users/snapshotpl/events{/privacy}","received_events_url":"https://api.github.com/users/snapshotpl/received_events","type":"User","site_admin":false},"body":"Mixed === scalar? ","created_at":"2018-08-16T14:31:50Z","updated_at":"2018-08-16T14:48:46Z","html_url":"https://github.com/rstgroup/object-builder/pull/6#discussion_r210619542","pull_request_url":"https://api.github.com/repos/rstgroup/object-builder/pulls/6","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/rstgroup/object-builder/pulls/comments/210619542"},"html":{"href":"https://github.com/rstgroup/object-builder/pull/6#discussion_r210619542"},"pull_request":{"href":"https://api.github.com/repos/rstgroup/object-builder/pulls/6"}}},"pull_request":{"url":"https://api.github.com/repos/rstgroup/object-builder/pulls/6","id":206257091,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA2MjU3MDkx","html_url":"https://github.com/rstgroup/object-builder/pull/6","diff_url":"https://github.com/rstgroup/object-builder/pull/6.diff","patch_url":"https://github.com/rstgroup/object-builder/pull/6.patch","issue_url":"https://api.github.com/repos/rstgroup/object-builder/issues/6","number":6,"state":"open","locked":false,"title":"Blueprint building","user":{"login":"gardziejewskik","id":18066631,"node_id":"MDQ6VXNlcjE4MDY2NjMx","avatar_url":"https://avatars3.githubusercontent.com/u/18066631?v=4","gravatar_id":"","url":"https://api.github.com/users/gardziejewskik","html_url":"https://github.com/gardziejewskik","followers_url":"https://api.github.com/users/gardziejewskik/followers","following_url":"https://api.github.com/users/gardziejewskik/following{/other_user}","gists_url":"https://api.github.com/users/gardziejewskik/gists{/gist_id}","starred_url":"https://api.github.com/users/gardziejewskik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gardziejewskik/subscriptions","organizations_url":"https://api.github.com/users/gardziejewskik/orgs","repos_url":"https://api.github.com/users/gardziejewskik/repos","events_url":"https://api.github.com/users/gardziejewskik/events{/privacy}","received_events_url":"https://api.github.com/users/gardziejewskik/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-08-05T20:49:32Z","updated_at":"2018-08-16T14:48:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1fa5f2cc675fd0c6dcf2b9f69906ab4d64a6195b","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/rstgroup/object-builder/pulls/6/commits","review_comments_url":"https://api.github.com/repos/rstgroup/object-builder/pulls/6/comments","review_comment_url":"https://api.github.com/repos/rstgroup/object-builder/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rstgroup/object-builder/issues/6/comments","statuses_url":"https://api.github.com/repos/rstgroup/object-builder/statuses/73aa8d2e2ac1f5762a83a9db4177fec651e6a36a","head":{"label":"rstgroup:blueprint-building","ref":"blueprint-building","sha":"73aa8d2e2ac1f5762a83a9db4177fec651e6a36a","user":{"login":"rstgroup","id":5242695,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUyNDI2OTU=","avatar_url":"https://avatars3.githubusercontent.com/u/5242695?v=4","gravatar_id":"","url":"https://api.github.com/users/rstgroup","html_url":"https://github.com/rstgroup","followers_url":"https://api.github.com/users/rstgroup/followers","following_url":"https://api.github.com/users/rstgroup/following{/other_user}","gists_url":"https://api.github.com/users/rstgroup/gists{/gist_id}","starred_url":"https://api.github.com/users/rstgroup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rstgroup/subscriptions","organizations_url":"https://api.github.com/users/rstgroup/orgs","repos_url":"https://api.github.com/users/rstgroup/repos","events_url":"https://api.github.com/users/rstgroup/events{/privacy}","received_events_url":"https://api.github.com/users/rstgroup/received_events","type":"Organization","site_admin":false},"repo":{"id":141293665,"node_id":"MDEwOlJlcG9zaXRvcnkxNDEyOTM2NjU=","name":"object-builder","full_name":"rstgroup/object-builder","owner":{"login":"rstgroup","id":5242695,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUyNDI2OTU=","avatar_url":"https://avatars3.githubusercontent.com/u/5242695?v=4","gravatar_id":"","url":"https://api.github.com/users/rstgroup","html_url":"https://github.com/rstgroup","followers_url":"https://api.github.com/users/rstgroup/followers","following_url":"https://api.github.com/users/rstgroup/following{/other_user}","gists_url":"https://api.github.com/users/rstgroup/gists{/gist_id}","starred_url":"https://api.github.com/users/rstgroup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rstgroup/subscriptions","organizations_url":"https://api.github.com/users/rstgroup/orgs","repos_url":"https://api.github.com/users/rstgroup/repos","events_url":"https://api.github.com/users/rstgroup/events{/privacy}","received_events_url":"https://api.github.com/users/rstgroup/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rstgroup/object-builder","description":null,"fork":false,"url":"https://api.github.com/repos/rstgroup/object-builder","forks_url":"https://api.github.com/repos/rstgroup/object-builder/forks","keys_url":"https://api.github.com/repos/rstgroup/object-builder/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rstgroup/object-builder/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rstgroup/object-builder/teams","hooks_url":"https://api.github.com/repos/rstgroup/object-builder/hooks","issue_events_url":"https://api.github.com/repos/rstgroup/object-builder/issues/events{/number}","events_url":"https://api.github.com/repos/rstgroup/object-builder/events","assignees_url":"https://api.github.com/repos/rstgroup/object-builder/assignees{/user}","branches_url":"https://api.github.com/repos/rstgroup/object-builder/branches{/branch}","tags_url":"https://api.github.com/repos/rstgroup/object-builder/tags","blobs_url":"https://api.github.com/repos/rstgroup/object-builder/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rstgroup/object-builder/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rstgroup/object-builder/git/refs{/sha}","trees_url":"https://api.github.com/repos/rstgroup/object-builder/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rstgroup/object-builder/statuses/{sha}","languages_url":"https://api.github.com/repos/rstgroup/object-builder/languages","stargazers_url":"https://api.github.com/repos/rstgroup/object-builder/stargazers","contributors_url":"https://api.github.com/repos/rstgroup/object-builder/contributors","subscribers_url":"https://api.github.com/repos/rstgroup/object-builder/subscribers","subscription_url":"https://api.github.com/repos/rstgroup/object-builder/subscription","commits_url":"https://api.github.com/repos/rstgroup/object-builder/commits{/sha}","git_commits_url":"https://api.github.com/repos/rstgroup/object-builder/git/commits{/sha}","comments_url":"https://api.github.com/repos/rstgroup/object-builder/comments{/number}","issue_comment_url":"https://api.github.com/repos/rstgroup/object-builder/issues/comments{/number}","contents_url":"https://api.github.com/repos/rstgroup/object-builder/contents/{+path}","compare_url":"https://api.github.com/repos/rstgroup/object-builder/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rstgroup/object-builder/merges","archive_url":"https://api.github.com/repos/rstgroup/object-builder/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rstgroup/object-builder/downloads","issues_url":"https://api.github.com/repos/rstgroup/object-builder/issues{/number}","pulls_url":"https://api.github.com/repos/rstgroup/object-builder/pulls{/number}","milestones_url":"https://api.github.com/repos/rstgroup/object-builder/milestones{/number}","notifications_url":"https://api.github.com/repos/rstgroup/object-builder/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rstgroup/object-builder/labels{/name}","releases_url":"https://api.github.com/repos/rstgroup/object-builder/releases{/id}","deployments_url":"https://api.github.com/repos/rstgroup/object-builder/deployments","created_at":"2018-07-17T13:28:50Z","updated_at":"2018-08-02T13:40:41Z","pushed_at":"2018-08-15T09:46:46Z","git_url":"git://github.com/rstgroup/object-builder.git","ssh_url":"git@github.com:rstgroup/object-builder.git","clone_url":"https://github.com/rstgroup/object-builder.git","svn_url":"https://github.com/rstgroup/object-builder","homepage":null,"size":94,"stargazers_count":5,"watchers_count":5,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":1,"open_issues":1,"watchers":5,"default_branch":"master"}},"base":{"label":"rstgroup:master","ref":"master","sha":"625ee0d4fe4174c6192859339a4b9f40b6a77c82","user":{"login":"rstgroup","id":5242695,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUyNDI2OTU=","avatar_url":"https://avatars3.githubusercontent.com/u/5242695?v=4","gravatar_id":"","url":"https://api.github.com/users/rstgroup","html_url":"https://github.com/rstgroup","followers_url":"https://api.github.com/users/rstgroup/followers","following_url":"https://api.github.com/users/rstgroup/following{/other_user}","gists_url":"https://api.github.com/users/rstgroup/gists{/gist_id}","starred_url":"https://api.github.com/users/rstgroup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rstgroup/subscriptions","organizations_url":"https://api.github.com/users/rstgroup/orgs","repos_url":"https://api.github.com/users/rstgroup/repos","events_url":"https://api.github.com/users/rstgroup/events{/privacy}","received_events_url":"https://api.github.com/users/rstgroup/received_events","type":"Organization","site_admin":false},"repo":{"id":141293665,"node_id":"MDEwOlJlcG9zaXRvcnkxNDEyOTM2NjU=","name":"object-builder","full_name":"rstgroup/object-builder","owner":{"login":"rstgroup","id":5242695,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUyNDI2OTU=","avatar_url":"https://avatars3.githubusercontent.com/u/5242695?v=4","gravatar_id":"","url":"https://api.github.com/users/rstgroup","html_url":"https://github.com/rstgroup","followers_url":"https://api.github.com/users/rstgroup/followers","following_url":"https://api.github.com/users/rstgroup/following{/other_user}","gists_url":"https://api.github.com/users/rstgroup/gists{/gist_id}","starred_url":"https://api.github.com/users/rstgroup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rstgroup/subscriptions","organizations_url":"https://api.github.com/users/rstgroup/orgs","repos_url":"https://api.github.com/users/rstgroup/repos","events_url":"https://api.github.com/users/rstgroup/events{/privacy}","received_events_url":"https://api.github.com/users/rstgroup/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rstgroup/object-builder","description":null,"fork":false,"url":"https://api.github.com/repos/rstgroup/object-builder","forks_url":"https://api.github.com/repos/rstgroup/object-builder/forks","keys_url":"https://api.github.com/repos/rstgroup/object-builder/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rstgroup/object-builder/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rstgroup/object-builder/teams","hooks_url":"https://api.github.com/repos/rstgroup/object-builder/hooks","issue_events_url":"https://api.github.com/repos/rstgroup/object-builder/issues/events{/number}","events_url":"https://api.github.com/repos/rstgroup/object-builder/events","assignees_url":"https://api.github.com/repos/rstgroup/object-builder/assignees{/user}","branches_url":"https://api.github.com/repos/rstgroup/object-builder/branches{/branch}","tags_url":"https://api.github.com/repos/rstgroup/object-builder/tags","blobs_url":"https://api.github.com/repos/rstgroup/object-builder/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rstgroup/object-builder/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rstgroup/object-builder/git/refs{/sha}","trees_url":"https://api.github.com/repos/rstgroup/object-builder/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rstgroup/object-builder/statuses/{sha}","languages_url":"https://api.github.com/repos/rstgroup/object-builder/languages","stargazers_url":"https://api.github.com/repos/rstgroup/object-builder/stargazers","contributors_url":"https://api.github.com/repos/rstgroup/object-builder/contributors","subscribers_url":"https://api.github.com/repos/rstgroup/object-builder/subscribers","subscription_url":"https://api.github.com/repos/rstgroup/object-builder/subscription","commits_url":"https://api.github.com/repos/rstgroup/object-builder/commits{/sha}","git_commits_url":"https://api.github.com/repos/rstgroup/object-builder/git/commits{/sha}","comments_url":"https://api.github.com/repos/rstgroup/object-builder/comments{/number}","issue_comment_url":"https://api.github.com/repos/rstgroup/object-builder/issues/comments{/number}","contents_url":"https://api.github.com/repos/rstgroup/object-builder/contents/{+path}","compare_url":"https://api.github.com/repos/rstgroup/object-builder/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rstgroup/object-builder/merges","archive_url":"https://api.github.com/repos/rstgroup/object-builder/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rstgroup/object-builder/downloads","issues_url":"https://api.github.com/repos/rstgroup/object-builder/issues{/number}","pulls_url":"https://api.github.com/repos/rstgroup/object-builder/pulls{/number}","milestones_url":"https://api.github.com/repos/rstgroup/object-builder/milestones{/number}","notifications_url":"https://api.github.com/repos/rstgroup/object-builder/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rstgroup/object-builder/labels{/name}","releases_url":"https://api.github.com/repos/rstgroup/object-builder/releases{/id}","deployments_url":"https://api.github.com/repos/rstgroup/object-builder/deployments","created_at":"2018-07-17T13:28:50Z","updated_at":"2018-08-02T13:40:41Z","pushed_at":"2018-08-15T09:46:46Z","git_url":"git://github.com/rstgroup/object-builder.git","ssh_url":"git@github.com:rstgroup/object-builder.git","clone_url":"https://github.com/rstgroup/object-builder.git","svn_url":"https://github.com/rstgroup/object-builder","homepage":null,"size":94,"stargazers_count":5,"watchers_count":5,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":1,"open_issues":1,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rstgroup/object-builder/pulls/6"},"html":{"href":"https://github.com/rstgroup/object-builder/pull/6"},"issue":{"href":"https://api.github.com/repos/rstgroup/object-builder/issues/6"},"comments":{"href":"https://api.github.com/repos/rstgroup/object-builder/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/rstgroup/object-builder/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/rstgroup/object-builder/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rstgroup/object-builder/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/rstgroup/object-builder/statuses/73aa8d2e2ac1f5762a83a9db4177fec651e6a36a"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"snapshotpl"}}