{"action":"created","comment":{"url":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/pulls/comments/27373320","id":27373320,"diff_hunk":"@@ -0,0 +1,56 @@\n+<?php\n+\n+/*\n+ * This file is part of the PHP CS utility.\n+ *\n+ * (c) Fabien Potencier <fabien@symfony.com>\n+ *\n+ * This source file is subject to the MIT license that is bundled\n+ * with this source code in the file LICENSE.\n+ */\n+\n+namespace Symfony\\CS\\Fixer\\Contrib;\n+\n+use Symfony\\CS\\AbstractFixer;\n+use Symfony\\CS\\Tokenizer\\Token;\n+use Symfony\\CS\\Tokenizer\\Tokens;\n+\n+/**\n+ * @author Vincent Klaiber <hello@vinkla.com>\n+ */\n+class ShortEchoTagFixer extends AbstractFixer\n+{\n+    /**\n+     * {@inheritdoc}\n+     */\n+    public function fix(\\SplFileInfo $file, $content)\n+    {\n+        $tokens = Tokens::fromCode($content);\n+\n+        foreach ($tokens as $index => $token) {\n+            if ('<?=' !== $token->getContent()) {","path":"Symfony/CS/Fixer/Contrib/ShortEchoTagFixer.php","position":31,"original_position":31,"commit_id":"5ec7b01a5464703bc23fce024523ae6fee9971c6","original_commit_id":"4d7d9b20327f768a44acd6c885525f7566bfe0ab","user":{"login":"vinkla","id":499192,"avatar_url":"https://avatars.githubusercontent.com/u/499192?v=3","gravatar_id":"","url":"https://api.github.com/users/vinkla","html_url":"https://github.com/vinkla","followers_url":"https://api.github.com/users/vinkla/followers","following_url":"https://api.github.com/users/vinkla/following{/other_user}","gists_url":"https://api.github.com/users/vinkla/gists{/gist_id}","starred_url":"https://api.github.com/users/vinkla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vinkla/subscriptions","organizations_url":"https://api.github.com/users/vinkla/orgs","repos_url":"https://api.github.com/users/vinkla/repos","events_url":"https://api.github.com/users/vinkla/events{/privacy}","received_events_url":"https://api.github.com/users/vinkla/received_events","type":"User","site_admin":false},"body":"Thanks for explaining. Really appreciate it, I want to learn :) \r\n\r\nHow about now?\r\n\r\n```php\r\nif ('<?=' !== $token->getContent()) {\r\n    continue;\r\n}\r\n\r\n$token->override([T_OPEN_TAG, '<?php', $token->getLine()]);\r\n\r\n$tokens->insertAt($index, new Token(array(T_ECHO, 'echo')));\r\n\r\nif (!$tokens[$index + 1]->isWhitespace()) {\r\n    $tokens->insertAt($index + 1, new Token(array(T_WHITESPACE, ' ')));\r\n}\r\n```","created_at":"2015-03-30T08:30:28Z","updated_at":"2015-03-30T08:30:28Z","html_url":"https://github.com/FriendsOfPHP/PHP-CS-Fixer/pull/1097#discussion_r27373320","pull_request_url":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/pulls/1097","_links":{"self":{"href":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/pulls/comments/27373320"},"html":{"href":"https://github.com/FriendsOfPHP/PHP-CS-Fixer/pull/1097#discussion_r27373320"},"pull_request":{"href":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/pulls/1097"}}},"pull_request":{"url":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/pulls/1097","id":32117015,"html_url":"https://github.com/FriendsOfPHP/PHP-CS-Fixer/pull/1097","diff_url":"https://github.com/FriendsOfPHP/PHP-CS-Fixer/pull/1097.diff","patch_url":"https://github.com/FriendsOfPHP/PHP-CS-Fixer/pull/1097.patch","issue_url":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/issues/1097","number":1097,"state":"open","locked":false,"title":"Added ShortEchoTagFixer","user":{"login":"vinkla","id":499192,"avatar_url":"https://avatars.githubusercontent.com/u/499192?v=3","gravatar_id":"","url":"https://api.github.com/users/vinkla","html_url":"https://github.com/vinkla","followers_url":"https://api.github.com/users/vinkla/followers","following_url":"https://api.github.com/users/vinkla/following{/other_user}","gists_url":"https://api.github.com/users/vinkla/gists{/gist_id}","starred_url":"https://api.github.com/users/vinkla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vinkla/subscriptions","organizations_url":"https://api.github.com/users/vinkla/orgs","repos_url":"https://api.github.com/users/vinkla/repos","events_url":"https://api.github.com/users/vinkla/events{/privacy}","received_events_url":"https://api.github.com/users/vinkla/received_events","type":"User","site_admin":false},"body":"Replace short-eco `<?=` syntax with long format `<?php echo` syntax. As discussed in #1095. \r\n\r\nThis is my first try at creating a fixer and any help would be a lot appreciated! What can I do more to make this fixer better? \r\n","created_at":"2015-03-27T15:29:13Z","updated_at":"2015-03-30T08:30:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"736fade0254562b9100d59c9216a6eeb1181762e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/pulls/1097/commits","review_comments_url":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/pulls/1097/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/1097/comments","statuses_url":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/statuses/5ec7b01a5464703bc23fce024523ae6fee9971c6","head":{"label":"vinkla:ecotagfixer","ref":"ecotagfixer","sha":"5ec7b01a5464703bc23fce024523ae6fee9971c6","user":{"login":"vinkla","id":499192,"avatar_url":"https://avatars.githubusercontent.com/u/499192?v=3","gravatar_id":"","url":"https://api.github.com/users/vinkla","html_url":"https://github.com/vinkla","followers_url":"https://api.github.com/users/vinkla/followers","following_url":"https://api.github.com/users/vinkla/following{/other_user}","gists_url":"https://api.github.com/users/vinkla/gists{/gist_id}","starred_url":"https://api.github.com/users/vinkla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vinkla/subscriptions","organizations_url":"https://api.github.com/users/vinkla/orgs","repos_url":"https://api.github.com/users/vinkla/repos","events_url":"https://api.github.com/users/vinkla/events{/privacy}","received_events_url":"https://api.github.com/users/vinkla/received_events","type":"User","site_admin":false},"repo":{"id":32993134,"name":"PHP-CS-Fixer","full_name":"vinkla/PHP-CS-Fixer","owner":{"login":"vinkla","id":499192,"avatar_url":"https://avatars.githubusercontent.com/u/499192?v=3","gravatar_id":"","url":"https://api.github.com/users/vinkla","html_url":"https://github.com/vinkla","followers_url":"https://api.github.com/users/vinkla/followers","following_url":"https://api.github.com/users/vinkla/following{/other_user}","gists_url":"https://api.github.com/users/vinkla/gists{/gist_id}","starred_url":"https://api.github.com/users/vinkla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vinkla/subscriptions","organizations_url":"https://api.github.com/users/vinkla/orgs","repos_url":"https://api.github.com/users/vinkla/repos","events_url":"https://api.github.com/users/vinkla/events{/privacy}","received_events_url":"https://api.github.com/users/vinkla/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vinkla/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/vinkla/PHP-CS-Fixer","forks_url":"https://api.github.com/repos/vinkla/PHP-CS-Fixer/forks","keys_url":"https://api.github.com/repos/vinkla/PHP-CS-Fixer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vinkla/PHP-CS-Fixer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vinkla/PHP-CS-Fixer/teams","hooks_url":"https://api.github.com/repos/vinkla/PHP-CS-Fixer/hooks","issue_events_url":"https://api.github.com/repos/vinkla/PHP-CS-Fixer/issues/events{/number}","events_url":"https://api.github.com/repos/vinkla/PHP-CS-Fixer/events","assignees_url":"https://api.github.com/repos/vinkla/PHP-CS-Fixer/assignees{/user}","branches_url":"https://api.github.com/repos/vinkla/PHP-CS-Fixer/branches{/branch}","tags_url":"https://api.github.com/repos/vinkla/PHP-CS-Fixer/tags","blobs_url":"https://api.github.com/repos/vinkla/PHP-CS-Fixer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vinkla/PHP-CS-Fixer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vinkla/PHP-CS-Fixer/git/refs{/sha}","trees_url":"https://api.github.com/repos/vinkla/PHP-CS-Fixer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vinkla/PHP-CS-Fixer/statuses/{sha}","languages_url":"https://api.github.com/repos/vinkla/PHP-CS-Fixer/languages","stargazers_url":"https://api.github.com/repos/vinkla/PHP-CS-Fixer/stargazers","contributors_url":"https://api.github.com/repos/vinkla/PHP-CS-Fixer/contributors","subscribers_url":"https://api.github.com/repos/vinkla/PHP-CS-Fixer/subscribers","subscription_url":"https://api.github.com/repos/vinkla/PHP-CS-Fixer/subscription","commits_url":"https://api.github.com/repos/vinkla/PHP-CS-Fixer/commits{/sha}","git_commits_url":"https://api.github.com/repos/vinkla/PHP-CS-Fixer/git/commits{/sha}","comments_url":"https://api.github.com/repos/vinkla/PHP-CS-Fixer/comments{/number}","issue_comment_url":"https://api.github.com/repos/vinkla/PHP-CS-Fixer/issues/comments{/number}","contents_url":"https://api.github.com/repos/vinkla/PHP-CS-Fixer/contents/{+path}","compare_url":"https://api.github.com/repos/vinkla/PHP-CS-Fixer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vinkla/PHP-CS-Fixer/merges","archive_url":"https://api.github.com/repos/vinkla/PHP-CS-Fixer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vinkla/PHP-CS-Fixer/downloads","issues_url":"https://api.github.com/repos/vinkla/PHP-CS-Fixer/issues{/number}","pulls_url":"https://api.github.com/repos/vinkla/PHP-CS-Fixer/pulls{/number}","milestones_url":"https://api.github.com/repos/vinkla/PHP-CS-Fixer/milestones{/number}","notifications_url":"https://api.github.com/repos/vinkla/PHP-CS-Fixer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vinkla/PHP-CS-Fixer/labels{/name}","releases_url":"https://api.github.com/repos/vinkla/PHP-CS-Fixer/releases{/id}","created_at":"2015-03-27T15:16:01Z","updated_at":"2015-03-27T15:16:02Z","pushed_at":"2015-03-30T06:44:10Z","git_url":"git://github.com/vinkla/PHP-CS-Fixer.git","ssh_url":"git@github.com:vinkla/PHP-CS-Fixer.git","clone_url":"https://github.com/vinkla/PHP-CS-Fixer.git","svn_url":"https://github.com/vinkla/PHP-CS-Fixer","homepage":"cs.sensiolabs.org","size":2424,"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.7"}},"base":{"label":"FriendsOfPHP:1.7","ref":"1.7","sha":"a32039fc557cd8e6db209eaa41c3ba85d33b2fc1","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}","created_at":"2012-05-16T06:42:23Z","updated_at":"2015-03-29T23:29:15Z","pushed_at":"2015-03-30T06:44:11Z","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":12318,"stargazers_count":2079,"watchers_count":2079,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":326,"mirror_url":null,"open_issues_count":68,"forks":326,"open_issues":68,"watchers":2079,"default_branch":"1.7"}},"_links":{"self":{"href":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/pulls/1097"},"html":{"href":"https://github.com/FriendsOfPHP/PHP-CS-Fixer/pull/1097"},"issue":{"href":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/issues/1097"},"comments":{"href":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/issues/1097/comments"},"review_comments":{"href":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/pulls/1097/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/1097/commits"},"statuses":{"href":"https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/statuses/5ec7b01a5464703bc23fce024523ae6fee9971c6"}}}}