{"action":"created","comment":{"url":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/pulls/comments/52429501","id":52429501,"diff_hunk":"@@ -390,13 +392,51 @@ private function resolveConfig()\n      */\n     private function resolveConfigPath()\n     {\n-        if (is_file($this->path)) {\n-            $this->config->finder(new \\ArrayIterator(array(new \\SplFileInfo($this->path))));\n-        } elseif ($this->isStdIn) {\n+        if ($this->isStdIn) {\n             $this->config->finder(new \\ArrayIterator(array(new StdinFileInfo())));\n-        } elseif (null !== $this->path) {\n-            $this->config->setDir($this->path);\n+\n+            return;\n+        }\n+\n+        if (null === $this->path) {\n+            return;\n         }\n+\n+        // - when we already have a valid finder - create intersection iterator of current finder and provided path\n+        // - when we don't have valid finder - prepare new iterator\n+        $iterator = null;\n+        $currentFinder = $this->config->getFinder();\n+        $path = realpath($this->path);\n+        $isFile = is_file($path);\n+\n+        if ($isFile) {\n+            $callback = function (\\SplFileInfo $current) use ($path) {\n+                return $current->getRealPath() === $path;\n+            };\n+        } else {\n+            $path .= DIRECTORY_SEPARATOR;\n+            $callback = function (\\SplFileInfo $current) use ($path) {\n+                return 0 === strpos($current->getRealPath(), $path);\n+            };\n+        }\n+\n+        try {\n+            $iterator = new \\CallbackFilterIterator(\n+                $currentFinder instanceof \\IteratorAggregate ? $currentFinder->getIterator() : $currentFinder,\n+                $callback\n+            );\n+        } catch (\\LogicException $e) {\n+            $iterator = $isFile\n+                ? new \\ArrayIterator(array(new SymfonySplFileInfo(\n+                    $this->path,\n+                    substr(dirname($this->path), strlen($this->cwd) + 1),\n+                    substr($this->path, strlen($this->cwd) + 1)\n+                )))\n+                : $currentFinder->in($this->path)","path":"src/Console/ConfigurationResolver.php","position":63,"original_position":63,"commit_id":"6b1ebafac58f20f6364348985fbdbaa317fc4abf","original_commit_id":"6b1ebafac58f20f6364348985fbdbaa317fc4abf","user":{"login":"gharlan","id":330436,"avatar_url":"https://avatars.githubusercontent.com/u/330436?v=3","gravatar_id":"","url":"https://api.github.com/users/gharlan","html_url":"https://github.com/gharlan","followers_url":"https://api.github.com/users/gharlan/followers","following_url":"https://api.github.com/users/gharlan/following{/other_user}","gists_url":"https://api.github.com/users/gharlan/gists{/gist_id}","starred_url":"https://api.github.com/users/gharlan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gharlan/subscriptions","organizations_url":"https://api.github.com/users/gharlan/orgs","repos_url":"https://api.github.com/users/gharlan/repos","events_url":"https://api.github.com/users/gharlan/events{/privacy}","received_events_url":"https://api.github.com/users/gharlan/received_events","type":"User","site_admin":false},"body":"Isn't it possible that `$currentFinder` is not a symfony finder instance, so the method `in` would not exist?\r\n","created_at":"2016-02-10T08:55:12Z","updated_at":"2016-02-10T08:55:12Z","html_url":"https://github.com/FriendsOfPHP/PHP-CS-Fixer/pull/1742#discussion_r52429501","pull_request_url":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/pulls/1742","_links":{"self":{"href":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/pulls/comments/52429501"},"html":{"href":"https://github.com/FriendsOfPHP/PHP-CS-Fixer/pull/1742#discussion_r52429501"},"pull_request":{"href":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/pulls/1742"}}},"pull_request":{"url":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/pulls/1742","id":58065312,"html_url":"https://github.com/FriendsOfPHP/PHP-CS-Fixer/pull/1742","diff_url":"https://github.com/FriendsOfPHP/PHP-CS-Fixer/pull/1742.diff","patch_url":"https://github.com/FriendsOfPHP/PHP-CS-Fixer/pull/1742.patch","issue_url":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/issues/1742","number":1742,"state":"open","locked":false,"title":"path argument is used to create an intersection with existing finder","user":{"login":"keradus","id":2716794,"avatar_url":"https://avatars.githubusercontent.com/u/2716794?v=3","gravatar_id":"","url":"https://api.github.com/users/keradus","html_url":"https://github.com/keradus","followers_url":"https://api.github.com/users/keradus/followers","following_url":"https://api.github.com/users/keradus/following{/other_user}","gists_url":"https://api.github.com/users/keradus/gists{/gist_id}","starred_url":"https://api.github.com/users/keradus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keradus/subscriptions","organizations_url":"https://api.github.com/users/keradus/orgs","repos_url":"https://api.github.com/users/keradus/repos","events_url":"https://api.github.com/users/keradus/events{/privacy}","received_events_url":"https://api.github.com/users/keradus/received_events","type":"User","site_admin":false},"body":"ref #1719 \r\n\r\n@tifabien , please, could you heavily play with this change?\r\n(especially from CLI user side and your hooks)","created_at":"2016-02-02T23:04:53Z","updated_at":"2016-02-10T08:55:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fe949ab8a25d4e1be1a93f491b2e939755b9c2e5","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/pulls/1742/commits","review_comments_url":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/pulls/1742/comments","review_comment_url":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/issues/1742/comments","statuses_url":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/statuses/6b1ebafac58f20f6364348985fbdbaa317fc4abf","head":{"label":"keradus:2.x-path","ref":"2.x-path","sha":"6b1ebafac58f20f6364348985fbdbaa317fc4abf","user":{"login":"keradus","id":2716794,"avatar_url":"https://avatars.githubusercontent.com/u/2716794?v=3","gravatar_id":"","url":"https://api.github.com/users/keradus","html_url":"https://github.com/keradus","followers_url":"https://api.github.com/users/keradus/followers","following_url":"https://api.github.com/users/keradus/following{/other_user}","gists_url":"https://api.github.com/users/keradus/gists{/gist_id}","starred_url":"https://api.github.com/users/keradus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keradus/subscriptions","organizations_url":"https://api.github.com/users/keradus/orgs","repos_url":"https://api.github.com/users/keradus/repos","events_url":"https://api.github.com/users/keradus/events{/privacy}","received_events_url":"https://api.github.com/users/keradus/received_events","type":"User","site_admin":false},"repo":{"id":21013087,"name":"PHP-CS-Fixer","full_name":"keradus/PHP-CS-Fixer","owner":{"login":"keradus","id":2716794,"avatar_url":"https://avatars.githubusercontent.com/u/2716794?v=3","gravatar_id":"","url":"https://api.github.com/users/keradus","html_url":"https://github.com/keradus","followers_url":"https://api.github.com/users/keradus/followers","following_url":"https://api.github.com/users/keradus/following{/other_user}","gists_url":"https://api.github.com/users/keradus/gists{/gist_id}","starred_url":"https://api.github.com/users/keradus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keradus/subscriptions","organizations_url":"https://api.github.com/users/keradus/orgs","repos_url":"https://api.github.com/users/keradus/repos","events_url":"https://api.github.com/users/keradus/events{/privacy}","received_events_url":"https://api.github.com/users/keradus/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/keradus/PHP-CS-Fixer","description":"Analyzes some PHP source code and tries to fix coding standards issues (PSR-1 and PSR-2 compatible)","fork":true,"url":"https://api.github.com/repos/keradus/PHP-CS-Fixer","forks_url":"https://api.github.com/repos/keradus/PHP-CS-Fixer/forks","keys_url":"https://api.github.com/repos/keradus/PHP-CS-Fixer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/keradus/PHP-CS-Fixer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/keradus/PHP-CS-Fixer/teams","hooks_url":"https://api.github.com/repos/keradus/PHP-CS-Fixer/hooks","issue_events_url":"https://api.github.com/repos/keradus/PHP-CS-Fixer/issues/events{/number}","events_url":"https://api.github.com/repos/keradus/PHP-CS-Fixer/events","assignees_url":"https://api.github.com/repos/keradus/PHP-CS-Fixer/assignees{/user}","branches_url":"https://api.github.com/repos/keradus/PHP-CS-Fixer/branches{/branch}","tags_url":"https://api.github.com/repos/keradus/PHP-CS-Fixer/tags","blobs_url":"https://api.github.com/repos/keradus/PHP-CS-Fixer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/keradus/PHP-CS-Fixer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/keradus/PHP-CS-Fixer/git/refs{/sha}","trees_url":"https://api.github.com/repos/keradus/PHP-CS-Fixer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/keradus/PHP-CS-Fixer/statuses/{sha}","languages_url":"https://api.github.com/repos/keradus/PHP-CS-Fixer/languages","stargazers_url":"https://api.github.com/repos/keradus/PHP-CS-Fixer/stargazers","contributors_url":"https://api.github.com/repos/keradus/PHP-CS-Fixer/contributors","subscribers_url":"https://api.github.com/repos/keradus/PHP-CS-Fixer/subscribers","subscription_url":"https://api.github.com/repos/keradus/PHP-CS-Fixer/subscription","commits_url":"https://api.github.com/repos/keradus/PHP-CS-Fixer/commits{/sha}","git_commits_url":"https://api.github.com/repos/keradus/PHP-CS-Fixer/git/commits{/sha}","comments_url":"https://api.github.com/repos/keradus/PHP-CS-Fixer/comments{/number}","issue_comment_url":"https://api.github.com/repos/keradus/PHP-CS-Fixer/issues/comments{/number}","contents_url":"https://api.github.com/repos/keradus/PHP-CS-Fixer/contents/{+path}","compare_url":"https://api.github.com/repos/keradus/PHP-CS-Fixer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/keradus/PHP-CS-Fixer/merges","archive_url":"https://api.github.com/repos/keradus/PHP-CS-Fixer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/keradus/PHP-CS-Fixer/downloads","issues_url":"https://api.github.com/repos/keradus/PHP-CS-Fixer/issues{/number}","pulls_url":"https://api.github.com/repos/keradus/PHP-CS-Fixer/pulls{/number}","milestones_url":"https://api.github.com/repos/keradus/PHP-CS-Fixer/milestones{/number}","notifications_url":"https://api.github.com/repos/keradus/PHP-CS-Fixer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/keradus/PHP-CS-Fixer/labels{/name}","releases_url":"https://api.github.com/repos/keradus/PHP-CS-Fixer/releases{/id}","deployments_url":"https://api.github.com/repos/keradus/PHP-CS-Fixer/deployments","created_at":"2014-06-19T19:38:35Z","updated_at":"2016-02-02T21:03:59Z","pushed_at":"2016-02-10T00:36:32Z","git_url":"git://github.com/keradus/PHP-CS-Fixer.git","ssh_url":"git@github.com:keradus/PHP-CS-Fixer.git","clone_url":"https://github.com/keradus/PHP-CS-Fixer.git","svn_url":"https://github.com/keradus/PHP-CS-Fixer","homepage":"cs.sensiolabs.org","size":5018,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"1.11"}},"base":{"label":"FriendsOfPHP:master","ref":"master","sha":"a674d597cf248dbfad467a2609f6a5cd2ff65e44","user":{"login":"FriendsOfPHP","id":5947812,"avatar_url":"https://avatars.githubusercontent.com/u/5947812?v=3","gravatar_id":"","url":"https://api.github.com/users/FriendsOfPHP","html_url":"https://github.com/FriendsOfPHP","followers_url":"https://api.github.com/users/FriendsOfPHP/followers","following_url":"https://api.github.com/users/FriendsOfPHP/following{/other_user}","gists_url":"https://api.github.com/users/FriendsOfPHP/gists{/gist_id}","starred_url":"https://api.github.com/users/FriendsOfPHP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FriendsOfPHP/subscriptions","organizations_url":"https://api.github.com/users/FriendsOfPHP/orgs","repos_url":"https://api.github.com/users/FriendsOfPHP/repos","events_url":"https://api.github.com/users/FriendsOfPHP/events{/privacy}","received_events_url":"https://api.github.com/users/FriendsOfPHP/received_events","type":"Organization","site_admin":false},"repo":{"id":4344257,"name":"PHP-CS-Fixer","full_name":"FriendsOfPHP/PHP-CS-Fixer","owner":{"login":"FriendsOfPHP","id":5947812,"avatar_url":"https://avatars.githubusercontent.com/u/5947812?v=3","gravatar_id":"","url":"https://api.github.com/users/FriendsOfPHP","html_url":"https://github.com/FriendsOfPHP","followers_url":"https://api.github.com/users/FriendsOfPHP/followers","following_url":"https://api.github.com/users/FriendsOfPHP/following{/other_user}","gists_url":"https://api.github.com/users/FriendsOfPHP/gists{/gist_id}","starred_url":"https://api.github.com/users/FriendsOfPHP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FriendsOfPHP/subscriptions","organizations_url":"https://api.github.com/users/FriendsOfPHP/orgs","repos_url":"https://api.github.com/users/FriendsOfPHP/repos","events_url":"https://api.github.com/users/FriendsOfPHP/events{/privacy}","received_events_url":"https://api.github.com/users/FriendsOfPHP/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/FriendsOfPHP/PHP-CS-Fixer","description":"Analyzes some PHP source code and tries to fix coding standards issues (PSR-1 and PSR-2 compatible)","fork":false,"url":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer","forks_url":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/forks","keys_url":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/teams","hooks_url":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/hooks","issue_events_url":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/issues/events{/number}","events_url":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/events","assignees_url":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/assignees{/user}","branches_url":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/branches{/branch}","tags_url":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/tags","blobs_url":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/git/refs{/sha}","trees_url":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/statuses/{sha}","languages_url":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/languages","stargazers_url":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/stargazers","contributors_url":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/contributors","subscribers_url":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/subscribers","subscription_url":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/subscription","commits_url":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/commits{/sha}","git_commits_url":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/git/commits{/sha}","comments_url":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/comments{/number}","issue_comment_url":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/issues/comments{/number}","contents_url":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/contents/{+path}","compare_url":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/merges","archive_url":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/downloads","issues_url":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/issues{/number}","pulls_url":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/pulls{/number}","milestones_url":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/milestones{/number}","notifications_url":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/labels{/name}","releases_url":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/releases{/id}","deployments_url":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/deployments","created_at":"2012-05-16T06:42:23Z","updated_at":"2016-02-09T22:25:46Z","pushed_at":"2016-02-10T08:28:24Z","git_url":"git://github.com/FriendsOfPHP/PHP-CS-Fixer.git","ssh_url":"git@github.com:FriendsOfPHP/PHP-CS-Fixer.git","clone_url":"https://github.com/FriendsOfPHP/PHP-CS-Fixer.git","svn_url":"https://github.com/FriendsOfPHP/PHP-CS-Fixer","homepage":"cs.sensiolabs.org","size":8114,"stargazers_count":2954,"watchers_count":2954,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":454,"mirror_url":null,"open_issues_count":118,"forks":454,"open_issues":118,"watchers":2954,"default_branch":"1.12"}},"_links":{"self":{"href":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/pulls/1742"},"html":{"href":"https://github.com/FriendsOfPHP/PHP-CS-Fixer/pull/1742"},"issue":{"href":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/issues/1742"},"comments":{"href":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/issues/1742/comments"},"review_comments":{"href":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/pulls/1742/comments"},"review_comment":{"href":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/pulls/1742/commits"},"statuses":{"href":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/statuses/6b1ebafac58f20f6364348985fbdbaa317fc4abf"}}}}