{"action":"created","comment":{"url":"https://api.github.com/repos/symfony/symfony/pulls/comments/28126497","id":28126497,"diff_hunk":"@@ -100,58 +102,8 @@ public function isExpandable()\n      */\n     public function toRegex($strictLeadingDot = true, $strictWildcardSlash = true)\n     {\n-        $firstByte = true;\n-        $escaping = false;\n-        $inCurlies = 0;\n-        $regex = '';\n-        $sizeGlob = strlen($this->pattern);\n-        for ($i = 0; $i < $sizeGlob; $i++) {\n-            $car = $this->pattern[$i];\n-            if ($firstByte) {\n-                if ($strictLeadingDot && '.' !== $car) {\n-                    $regex .= '(?=[^\\.])';\n-                }\n-\n-                $firstByte = false;\n-            }\n-\n-            if ('/' === $car) {\n-                $firstByte = true;\n-            }\n-\n-            if ('.' === $car || '(' === $car || ')' === $car || '|' === $car || '+' === $car || '^' === $car || '$' === $car) {\n-                $regex .= \"\\\\$car\";\n-            } elseif ('*' === $car) {\n-                $regex .= $escaping ? '\\\\*' : ($strictWildcardSlash ? '[^/]*' : '.*');\n-            } elseif ('?' === $car) {\n-                $regex .= $escaping ? '\\\\?' : ($strictWildcardSlash ? '[^/]' : '.');\n-            } elseif ('{' === $car) {\n-                $regex .= $escaping ? '\\\\{' : '(';\n-                if (!$escaping) {\n-                    ++$inCurlies;\n-                }\n-            } elseif ('}' === $car && $inCurlies) {\n-                $regex .= $escaping ? '}' : ')';\n-                if (!$escaping) {\n-                    --$inCurlies;\n-                }\n-            } elseif (',' === $car && $inCurlies) {\n-                $regex .= $escaping ? ',' : '|';\n-            } elseif ('\\\\' === $car) {\n-                if ($escaping) {\n-                    $regex .= '\\\\\\\\';\n-                    $escaping = false;\n-                } else {\n-                    $escaping = true;\n-                }\n-\n-                continue;\n-            } else {\n-                $regex .= $car;\n-            }\n-            $escaping = false;\n-        }\n-\n-        return new Regex('^'.$regex.'$');\n+        $regex = FinderGlob::toRegex($this->pattern, $strictLeadingDot, $strictWildcardSlash);\n+\n+        return new Regex(substr($regex, 1, -1));","path":"src/Symfony/Component/Finder/Expression/Glob.php","position":68,"original_position":68,"commit_id":"dab1c89c4e47f31a62e2324ea1d382e9ec933a3e","original_commit_id":"dab1c89c4e47f31a62e2324ea1d382e9ec933a3e","user":{"login":"jaytaph","id":241458,"avatar_url":"https://avatars.githubusercontent.com/u/241458?v=3","gravatar_id":"","url":"https://api.github.com/users/jaytaph","html_url":"https://github.com/jaytaph","followers_url":"https://api.github.com/users/jaytaph/followers","following_url":"https://api.github.com/users/jaytaph/following{/other_user}","gists_url":"https://api.github.com/users/jaytaph/gists{/gist_id}","starred_url":"https://api.github.com/users/jaytaph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaytaph/subscriptions","organizations_url":"https://api.github.com/users/jaytaph/orgs","repos_url":"https://api.github.com/users/jaytaph/repos","events_url":"https://api.github.com/users/jaytaph/events{/privacy}","received_events_url":"https://api.github.com/users/jaytaph/received_events","type":"User","site_admin":false},"body":"Perfect, I'll change the PR with this update","created_at":"2015-04-10T07:30:41Z","updated_at":"2015-04-10T07:30:41Z","html_url":"https://github.com/symfony/symfony/pull/14287#discussion_r28126497","pull_request_url":"https://api.github.com/repos/symfony/symfony/pulls/14287","_links":{"self":{"href":"https://api.github.com/repos/symfony/symfony/pulls/comments/28126497"},"html":{"href":"https://github.com/symfony/symfony/pull/14287#discussion_r28126497"},"pull_request":{"href":"https://api.github.com/repos/symfony/symfony/pulls/14287"}}},"pull_request":{"url":"https://api.github.com/repos/symfony/symfony/pulls/14287","id":32955573,"html_url":"https://github.com/symfony/symfony/pull/14287","diff_url":"https://github.com/symfony/symfony/pull/14287.diff","patch_url":"https://github.com/symfony/symfony/pull/14287.patch","issue_url":"https://api.github.com/repos/symfony/symfony/issues/14287","number":14287,"state":"open","locked":false,"title":"[Finder] Removed duplicated toRegex() code","user":{"login":"jaytaph","id":241458,"avatar_url":"https://avatars.githubusercontent.com/u/241458?v=3","gravatar_id":"","url":"https://api.github.com/users/jaytaph","html_url":"https://github.com/jaytaph","followers_url":"https://api.github.com/users/jaytaph/followers","following_url":"https://api.github.com/users/jaytaph/following{/other_user}","gists_url":"https://api.github.com/users/jaytaph/gists{/gist_id}","starred_url":"https://api.github.com/users/jaytaph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaytaph/subscriptions","organizations_url":"https://api.github.com/users/jaytaph/orgs","repos_url":"https://api.github.com/users/jaytaph/repos","events_url":"https://api.github.com/users/jaytaph/events{/privacy}","received_events_url":"https://api.github.com/users/jaytaph/received_events","type":"User","site_admin":false},"body":"This patch removes duplicated `toRegex()` code by using the already existing `Glob` class. As this class wasn't unit-tested to begin with, this duplication also makes sure this class is tested properly.\r\n\r\n| Q             | A\r\n| ------------- | ---\r\n| Bug fix?      | no\r\n| New feature?  | no\r\n| BC breaks?    | no\r\n| Deprecations? | no\r\n| Tests pass?   | yes\r\n| Fixed tickets | #14075\r\n| License       | MIT","created_at":"2015-04-09T13:31:36Z","updated_at":"2015-04-10T07:30:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8df0c610fc7ce87e3c3ec4a8121dd42a010f47ce","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/symfony/symfony/pulls/14287/commits","review_comments_url":"https://api.github.com/repos/symfony/symfony/pulls/14287/comments","review_comment_url":"https://api.github.com/repos/symfony/symfony/pulls/comments{/number}","comments_url":"https://api.github.com/repos/symfony/symfony/issues/14287/comments","statuses_url":"https://api.github.com/repos/symfony/symfony/statuses/dab1c89c4e47f31a62e2324ea1d382e9ec933a3e","head":{"label":"jaytaph:issue-14075","ref":"issue-14075","sha":"dab1c89c4e47f31a62e2324ea1d382e9ec933a3e","user":{"login":"jaytaph","id":241458,"avatar_url":"https://avatars.githubusercontent.com/u/241458?v=3","gravatar_id":"","url":"https://api.github.com/users/jaytaph","html_url":"https://github.com/jaytaph","followers_url":"https://api.github.com/users/jaytaph/followers","following_url":"https://api.github.com/users/jaytaph/following{/other_user}","gists_url":"https://api.github.com/users/jaytaph/gists{/gist_id}","starred_url":"https://api.github.com/users/jaytaph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaytaph/subscriptions","organizations_url":"https://api.github.com/users/jaytaph/orgs","repos_url":"https://api.github.com/users/jaytaph/repos","events_url":"https://api.github.com/users/jaytaph/events{/privacy}","received_events_url":"https://api.github.com/users/jaytaph/received_events","type":"User","site_admin":false},"repo":{"id":21613139,"name":"symfony","full_name":"jaytaph/symfony","owner":{"login":"jaytaph","id":241458,"avatar_url":"https://avatars.githubusercontent.com/u/241458?v=3","gravatar_id":"","url":"https://api.github.com/users/jaytaph","html_url":"https://github.com/jaytaph","followers_url":"https://api.github.com/users/jaytaph/followers","following_url":"https://api.github.com/users/jaytaph/following{/other_user}","gists_url":"https://api.github.com/users/jaytaph/gists{/gist_id}","starred_url":"https://api.github.com/users/jaytaph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaytaph/subscriptions","organizations_url":"https://api.github.com/users/jaytaph/orgs","repos_url":"https://api.github.com/users/jaytaph/repos","events_url":"https://api.github.com/users/jaytaph/events{/privacy}","received_events_url":"https://api.github.com/users/jaytaph/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jaytaph/symfony","description":"The Symfony PHP framework","fork":true,"url":"https://api.github.com/repos/jaytaph/symfony","forks_url":"https://api.github.com/repos/jaytaph/symfony/forks","keys_url":"https://api.github.com/repos/jaytaph/symfony/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jaytaph/symfony/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jaytaph/symfony/teams","hooks_url":"https://api.github.com/repos/jaytaph/symfony/hooks","issue_events_url":"https://api.github.com/repos/jaytaph/symfony/issues/events{/number}","events_url":"https://api.github.com/repos/jaytaph/symfony/events","assignees_url":"https://api.github.com/repos/jaytaph/symfony/assignees{/user}","branches_url":"https://api.github.com/repos/jaytaph/symfony/branches{/branch}","tags_url":"https://api.github.com/repos/jaytaph/symfony/tags","blobs_url":"https://api.github.com/repos/jaytaph/symfony/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jaytaph/symfony/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jaytaph/symfony/git/refs{/sha}","trees_url":"https://api.github.com/repos/jaytaph/symfony/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jaytaph/symfony/statuses/{sha}","languages_url":"https://api.github.com/repos/jaytaph/symfony/languages","stargazers_url":"https://api.github.com/repos/jaytaph/symfony/stargazers","contributors_url":"https://api.github.com/repos/jaytaph/symfony/contributors","subscribers_url":"https://api.github.com/repos/jaytaph/symfony/subscribers","subscription_url":"https://api.github.com/repos/jaytaph/symfony/subscription","commits_url":"https://api.github.com/repos/jaytaph/symfony/commits{/sha}","git_commits_url":"https://api.github.com/repos/jaytaph/symfony/git/commits{/sha}","comments_url":"https://api.github.com/repos/jaytaph/symfony/comments{/number}","issue_comment_url":"https://api.github.com/repos/jaytaph/symfony/issues/comments{/number}","contents_url":"https://api.github.com/repos/jaytaph/symfony/contents/{+path}","compare_url":"https://api.github.com/repos/jaytaph/symfony/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jaytaph/symfony/merges","archive_url":"https://api.github.com/repos/jaytaph/symfony/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jaytaph/symfony/downloads","issues_url":"https://api.github.com/repos/jaytaph/symfony/issues{/number}","pulls_url":"https://api.github.com/repos/jaytaph/symfony/pulls{/number}","milestones_url":"https://api.github.com/repos/jaytaph/symfony/milestones{/number}","notifications_url":"https://api.github.com/repos/jaytaph/symfony/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jaytaph/symfony/labels{/name}","releases_url":"https://api.github.com/repos/jaytaph/symfony/releases{/id}","created_at":"2014-07-08T13:13:20Z","updated_at":"2014-12-17T19:12:55Z","pushed_at":"2015-04-09T13:32:48Z","git_url":"git://github.com/jaytaph/symfony.git","ssh_url":"git@github.com:jaytaph/symfony.git","clone_url":"https://github.com/jaytaph/symfony.git","svn_url":"https://github.com/jaytaph/symfony","homepage":"symfony.com","size":54013,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":false,"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":"master"}},"base":{"label":"symfony:2.7","ref":"2.7","sha":"94eb3841633de759b9ab1ca028b78e3cfb0aeed7","user":{"login":"symfony","id":143937,"avatar_url":"https://avatars.githubusercontent.com/u/143937?v=3","gravatar_id":"","url":"https://api.github.com/users/symfony","html_url":"https://github.com/symfony","followers_url":"https://api.github.com/users/symfony/followers","following_url":"https://api.github.com/users/symfony/following{/other_user}","gists_url":"https://api.github.com/users/symfony/gists{/gist_id}","starred_url":"https://api.github.com/users/symfony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/symfony/subscriptions","organizations_url":"https://api.github.com/users/symfony/orgs","repos_url":"https://api.github.com/users/symfony/repos","events_url":"https://api.github.com/users/symfony/events{/privacy}","received_events_url":"https://api.github.com/users/symfony/received_events","type":"Organization","site_admin":false},"repo":{"id":458058,"name":"symfony","full_name":"symfony/symfony","owner":{"login":"symfony","id":143937,"avatar_url":"https://avatars.githubusercontent.com/u/143937?v=3","gravatar_id":"","url":"https://api.github.com/users/symfony","html_url":"https://github.com/symfony","followers_url":"https://api.github.com/users/symfony/followers","following_url":"https://api.github.com/users/symfony/following{/other_user}","gists_url":"https://api.github.com/users/symfony/gists{/gist_id}","starred_url":"https://api.github.com/users/symfony/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/symfony/subscriptions","organizations_url":"https://api.github.com/users/symfony/orgs","repos_url":"https://api.github.com/users/symfony/repos","events_url":"https://api.github.com/users/symfony/events{/privacy}","received_events_url":"https://api.github.com/users/symfony/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/symfony/symfony","description":"The Symfony PHP framework","fork":false,"url":"https://api.github.com/repos/symfony/symfony","forks_url":"https://api.github.com/repos/symfony/symfony/forks","keys_url":"https://api.github.com/repos/symfony/symfony/keys{/key_id}","collaborators_url":"https://api.github.com/repos/symfony/symfony/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/symfony/symfony/teams","hooks_url":"https://api.github.com/repos/symfony/symfony/hooks","issue_events_url":"https://api.github.com/repos/symfony/symfony/issues/events{/number}","events_url":"https://api.github.com/repos/symfony/symfony/events","assignees_url":"https://api.github.com/repos/symfony/symfony/assignees{/user}","branches_url":"https://api.github.com/repos/symfony/symfony/branches{/branch}","tags_url":"https://api.github.com/repos/symfony/symfony/tags","blobs_url":"https://api.github.com/repos/symfony/symfony/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/symfony/symfony/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/symfony/symfony/git/refs{/sha}","trees_url":"https://api.github.com/repos/symfony/symfony/git/trees{/sha}","statuses_url":"https://api.github.com/repos/symfony/symfony/statuses/{sha}","languages_url":"https://api.github.com/repos/symfony/symfony/languages","stargazers_url":"https://api.github.com/repos/symfony/symfony/stargazers","contributors_url":"https://api.github.com/repos/symfony/symfony/contributors","subscribers_url":"https://api.github.com/repos/symfony/symfony/subscribers","subscription_url":"https://api.github.com/repos/symfony/symfony/subscription","commits_url":"https://api.github.com/repos/symfony/symfony/commits{/sha}","git_commits_url":"https://api.github.com/repos/symfony/symfony/git/commits{/sha}","comments_url":"https://api.github.com/repos/symfony/symfony/comments{/number}","issue_comment_url":"https://api.github.com/repos/symfony/symfony/issues/comments{/number}","contents_url":"https://api.github.com/repos/symfony/symfony/contents/{+path}","compare_url":"https://api.github.com/repos/symfony/symfony/compare/{base}...{head}","merges_url":"https://api.github.com/repos/symfony/symfony/merges","archive_url":"https://api.github.com/repos/symfony/symfony/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/symfony/symfony/downloads","issues_url":"https://api.github.com/repos/symfony/symfony/issues{/number}","pulls_url":"https://api.github.com/repos/symfony/symfony/pulls{/number}","milestones_url":"https://api.github.com/repos/symfony/symfony/milestones{/number}","notifications_url":"https://api.github.com/repos/symfony/symfony/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/symfony/symfony/labels{/name}","releases_url":"https://api.github.com/repos/symfony/symfony/releases{/id}","created_at":"2010-01-04T14:21:21Z","updated_at":"2015-04-10T07:19:43Z","pushed_at":"2015-04-10T07:30:09Z","git_url":"git://github.com/symfony/symfony.git","ssh_url":"git@github.com:symfony/symfony.git","clone_url":"https://github.com/symfony/symfony.git","svn_url":"https://github.com/symfony/symfony","homepage":"symfony.com","size":218688,"stargazers_count":9985,"watchers_count":9985,"language":"PHP","has_issues":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":3918,"mirror_url":null,"open_issues_count":809,"forks":3918,"open_issues":809,"watchers":9985,"default_branch":"2.7"}},"_links":{"self":{"href":"https://api.github.com/repos/symfony/symfony/pulls/14287"},"html":{"href":"https://github.com/symfony/symfony/pull/14287"},"issue":{"href":"https://api.github.com/repos/symfony/symfony/issues/14287"},"comments":{"href":"https://api.github.com/repos/symfony/symfony/issues/14287/comments"},"review_comments":{"href":"https://api.github.com/repos/symfony/symfony/pulls/14287/comments"},"review_comment":{"href":"https://api.github.com/repos/symfony/symfony/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/symfony/symfony/pulls/14287/commits"},"statuses":{"href":"https://api.github.com/repos/symfony/symfony/statuses/dab1c89c4e47f31a62e2324ea1d382e9ec933a3e"}}}}