{"action":"created","comment":{"url":"https://api.github.com/repos/atom/language-php/pulls/comments/144972614","pull_request_review_id":69704536,"id":144972614,"diff_hunk":"@@ -3724,3 +3733,26 @@\n         ]\n       }\n     ]\n+  'ternary_shorthand':\n+    'match': '\\\\?:'\n+    'name': 'keyword.operator.ternary.php'\n+  'ternary_expression':\n+    'begin': '(?<!\\\\?)\\\\s*(\\\\?)\\\\s*(?!:|\\\\?)'\n+    'beginCaptures':\n+      '1':\n+        'name': 'keyword.operator.ternary.php'\n+    'end': '\\\\s*(:)\\\\s*'\n+    'endCaptures':\n+      '1':\n+        'name': 'keyword.operator.ternary.php'\n+    'patterns': [\n+      {\n+        'include': '#language'\n+      }\n+      {\n+        'include': '$self'","path":"grammars/php.cson","position":37,"original_position":37,"commit_id":"e27bf30c604ffeacc504ac36960ba76cd6bf4d8d","original_commit_id":"0fca6436ed798507ff48dfb40cbcb1bb6702e603","user":{"login":"dsifford","id":5240018,"avatar_url":"https://avatars0.githubusercontent.com/u/5240018?v=4","gravatar_id":"","url":"https://api.github.com/users/dsifford","html_url":"https://github.com/dsifford","followers_url":"https://api.github.com/users/dsifford/followers","following_url":"https://api.github.com/users/dsifford/following{/other_user}","gists_url":"https://api.github.com/users/dsifford/gists{/gist_id}","starred_url":"https://api.github.com/users/dsifford/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dsifford/subscriptions","organizations_url":"https://api.github.com/users/dsifford/orgs","repos_url":"https://api.github.com/users/dsifford/repos","events_url":"https://api.github.com/users/dsifford/events{/privacy}","received_events_url":"https://api.github.com/users/dsifford/received_events","type":"User","site_admin":false},"body":"Ah.. I think my confusion was that I thought `$self` was scoped at or below the current scope level and not the entire grammar. \r\n\r\nThanks for the clarification.","created_at":"2017-10-16T21:23:01Z","updated_at":"2017-10-16T21:23:01Z","html_url":"https://github.com/atom/language-php/pull/285#discussion_r144972614","pull_request_url":"https://api.github.com/repos/atom/language-php/pulls/285","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/atom/language-php/pulls/comments/144972614"},"html":{"href":"https://github.com/atom/language-php/pull/285#discussion_r144972614"},"pull_request":{"href":"https://api.github.com/repos/atom/language-php/pulls/285"}},"in_reply_to_id":144961221},"pull_request":{"url":"https://api.github.com/repos/atom/language-php/pulls/285","id":145015095,"html_url":"https://github.com/atom/language-php/pull/285","diff_url":"https://github.com/atom/language-php/pull/285.diff","patch_url":"https://github.com/atom/language-php/pull/285.patch","issue_url":"https://api.github.com/repos/atom/language-php/issues/285","number":285,"state":"open","locked":false,"title":"Add support for ternary and null coalescing operators","user":{"login":"dsifford","id":5240018,"avatar_url":"https://avatars0.githubusercontent.com/u/5240018?v=4","gravatar_id":"","url":"https://api.github.com/users/dsifford","html_url":"https://github.com/dsifford","followers_url":"https://api.github.com/users/dsifford/followers","following_url":"https://api.github.com/users/dsifford/following{/other_user}","gists_url":"https://api.github.com/users/dsifford/gists{/gist_id}","starred_url":"https://api.github.com/users/dsifford/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dsifford/subscriptions","organizations_url":"https://api.github.com/users/dsifford/orgs","repos_url":"https://api.github.com/users/dsifford/repos","events_url":"https://api.github.com/users/dsifford/events{/privacy}","received_events_url":"https://api.github.com/users/dsifford/received_events","type":"User","site_admin":false},"body":"This PR adds scopes for ternaries and the new (as of php7.0) null-coalescing operator.\r\n\r\n### Description of the Change\r\n\r\nCurrently, this is how the above items are scoped:\r\n\r\n```php\r\n// ternary expression\r\n  $foo = $bar ? $bar : 'baz';\r\n//            ^text.html.php meta.embedded.block.php source.php\r\n//                   ^text.html.php meta.embedded.block.php source.php\r\n\r\n// ternary shorthand\r\n  $foo = $bar ?: 'baz';\r\n//            ^^text.html.php meta.embedded.block.php source.php\r\n\r\n// null coalescing operator\r\n  $foo = $bar ?? 'baz';\r\n//            ^^text.html.php meta.embedded.block.php source.php\r\n```\r\n\r\nAnd here's how it is after the changes I made:\r\n\r\n\r\n```php\r\n// ternary expression\r\n  $foo = $bar ? $bar : 'baz';\r\n//            ^text.html.php meta.embedded.block.php source.php keyword.operator.ternary.php\r\n//                   ^text.html.php meta.embedded.block.php source.php keyword.operator.ternary.php\r\n\r\n// ternary shorthand\r\n  $foo = $bar ?: 'baz';\r\n//            ^^text.html.php meta.embedded.block.php source.php keyword.operator.ternary.php\r\n\r\n// null coalescing operator\r\n  $foo = $bar ?? 'baz';\r\n//            ^^text.html.php meta.embedded.block.php source.php keyword.operator.null-coalescing.php\r\n```\r\n\r\n### Alternate Designs\r\n\r\nIt would be possible to expand the specificity of the ternary expression scope (e.g. `(expr) : (val_if_true) ? (val_if_false)`) by wrapping the entire expression in `meta.expression.ternary.php` (or something along those lines), but I chose not to do that because it doesn't seem like it would add any value.\r\n\r\n### Benefits\r\n\r\n- Increased scope specificity.\r\n- Allows theme maintainers to colorize ternary and null coalescing operators the same as the other existing operators.\r\n\r\n### Possible Drawbacks\r\n\r\nNone to my knowledge.","created_at":"2017-10-05T20:38:32Z","updated_at":"2017-10-16T21:23:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"aa3789fac257fa2776aff9f5cd4a737ef3f16a13","assignee":{"login":"50Wliu","id":2766036,"avatar_url":"https://avatars0.githubusercontent.com/u/2766036?v=4","gravatar_id":"","url":"https://api.github.com/users/50Wliu","html_url":"https://github.com/50Wliu","followers_url":"https://api.github.com/users/50Wliu/followers","following_url":"https://api.github.com/users/50Wliu/following{/other_user}","gists_url":"https://api.github.com/users/50Wliu/gists{/gist_id}","starred_url":"https://api.github.com/users/50Wliu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/50Wliu/subscriptions","organizations_url":"https://api.github.com/users/50Wliu/orgs","repos_url":"https://api.github.com/users/50Wliu/repos","events_url":"https://api.github.com/users/50Wliu/events{/privacy}","received_events_url":"https://api.github.com/users/50Wliu/received_events","type":"User","site_admin":false},"assignees":[{"login":"50Wliu","id":2766036,"avatar_url":"https://avatars0.githubusercontent.com/u/2766036?v=4","gravatar_id":"","url":"https://api.github.com/users/50Wliu","html_url":"https://github.com/50Wliu","followers_url":"https://api.github.com/users/50Wliu/followers","following_url":"https://api.github.com/users/50Wliu/following{/other_user}","gists_url":"https://api.github.com/users/50Wliu/gists{/gist_id}","starred_url":"https://api.github.com/users/50Wliu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/50Wliu/subscriptions","organizations_url":"https://api.github.com/users/50Wliu/orgs","repos_url":"https://api.github.com/users/50Wliu/repos","events_url":"https://api.github.com/users/50Wliu/events{/privacy}","received_events_url":"https://api.github.com/users/50Wliu/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/atom/language-php/pulls/285/commits","review_comments_url":"https://api.github.com/repos/atom/language-php/pulls/285/comments","review_comment_url":"https://api.github.com/repos/atom/language-php/pulls/comments{/number}","comments_url":"https://api.github.com/repos/atom/language-php/issues/285/comments","statuses_url":"https://api.github.com/repos/atom/language-php/statuses/e27bf30c604ffeacc504ac36960ba76cd6bf4d8d","head":{"label":"dsifford:dsifford-ternary-operators","ref":"dsifford-ternary-operators","sha":"e27bf30c604ffeacc504ac36960ba76cd6bf4d8d","user":{"login":"dsifford","id":5240018,"avatar_url":"https://avatars0.githubusercontent.com/u/5240018?v=4","gravatar_id":"","url":"https://api.github.com/users/dsifford","html_url":"https://github.com/dsifford","followers_url":"https://api.github.com/users/dsifford/followers","following_url":"https://api.github.com/users/dsifford/following{/other_user}","gists_url":"https://api.github.com/users/dsifford/gists{/gist_id}","starred_url":"https://api.github.com/users/dsifford/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dsifford/subscriptions","organizations_url":"https://api.github.com/users/dsifford/orgs","repos_url":"https://api.github.com/users/dsifford/repos","events_url":"https://api.github.com/users/dsifford/events{/privacy}","received_events_url":"https://api.github.com/users/dsifford/received_events","type":"User","site_admin":false},"repo":{"id":105936047,"name":"language-php","full_name":"dsifford/language-php","owner":{"login":"dsifford","id":5240018,"avatar_url":"https://avatars0.githubusercontent.com/u/5240018?v=4","gravatar_id":"","url":"https://api.github.com/users/dsifford","html_url":"https://github.com/dsifford","followers_url":"https://api.github.com/users/dsifford/followers","following_url":"https://api.github.com/users/dsifford/following{/other_user}","gists_url":"https://api.github.com/users/dsifford/gists{/gist_id}","starred_url":"https://api.github.com/users/dsifford/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dsifford/subscriptions","organizations_url":"https://api.github.com/users/dsifford/orgs","repos_url":"https://api.github.com/users/dsifford/repos","events_url":"https://api.github.com/users/dsifford/events{/privacy}","received_events_url":"https://api.github.com/users/dsifford/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dsifford/language-php","description":"PHP package for Atom","fork":true,"url":"https://api.github.com/repos/dsifford/language-php","forks_url":"https://api.github.com/repos/dsifford/language-php/forks","keys_url":"https://api.github.com/repos/dsifford/language-php/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dsifford/language-php/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dsifford/language-php/teams","hooks_url":"https://api.github.com/repos/dsifford/language-php/hooks","issue_events_url":"https://api.github.com/repos/dsifford/language-php/issues/events{/number}","events_url":"https://api.github.com/repos/dsifford/language-php/events","assignees_url":"https://api.github.com/repos/dsifford/language-php/assignees{/user}","branches_url":"https://api.github.com/repos/dsifford/language-php/branches{/branch}","tags_url":"https://api.github.com/repos/dsifford/language-php/tags","blobs_url":"https://api.github.com/repos/dsifford/language-php/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dsifford/language-php/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dsifford/language-php/git/refs{/sha}","trees_url":"https://api.github.com/repos/dsifford/language-php/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dsifford/language-php/statuses/{sha}","languages_url":"https://api.github.com/repos/dsifford/language-php/languages","stargazers_url":"https://api.github.com/repos/dsifford/language-php/stargazers","contributors_url":"https://api.github.com/repos/dsifford/language-php/contributors","subscribers_url":"https://api.github.com/repos/dsifford/language-php/subscribers","subscription_url":"https://api.github.com/repos/dsifford/language-php/subscription","commits_url":"https://api.github.com/repos/dsifford/language-php/commits{/sha}","git_commits_url":"https://api.github.com/repos/dsifford/language-php/git/commits{/sha}","comments_url":"https://api.github.com/repos/dsifford/language-php/comments{/number}","issue_comment_url":"https://api.github.com/repos/dsifford/language-php/issues/comments{/number}","contents_url":"https://api.github.com/repos/dsifford/language-php/contents/{+path}","compare_url":"https://api.github.com/repos/dsifford/language-php/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dsifford/language-php/merges","archive_url":"https://api.github.com/repos/dsifford/language-php/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dsifford/language-php/downloads","issues_url":"https://api.github.com/repos/dsifford/language-php/issues{/number}","pulls_url":"https://api.github.com/repos/dsifford/language-php/pulls{/number}","milestones_url":"https://api.github.com/repos/dsifford/language-php/milestones{/number}","notifications_url":"https://api.github.com/repos/dsifford/language-php/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dsifford/language-php/labels{/name}","releases_url":"https://api.github.com/repos/dsifford/language-php/releases{/id}","deployments_url":"https://api.github.com/repos/dsifford/language-php/deployments","created_at":"2017-10-05T20:17:36Z","updated_at":"2017-10-05T20:17:38Z","pushed_at":"2017-10-16T20:58:59Z","git_url":"git://github.com/dsifford/language-php.git","ssh_url":"git@github.com:dsifford/language-php.git","clone_url":"https://github.com/dsifford/language-php.git","svn_url":"https://github.com/dsifford/language-php","homepage":null,"size":900,"stargazers_count":0,"watchers_count":0,"language":"CoffeeScript","has_issues":false,"has_projects":true,"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":"master"}},"base":{"label":"atom:master","ref":"master","sha":"aa095129f29f4ffbf5db6f154aa283997ddbca29","user":{"login":"atom","id":1089146,"avatar_url":"https://avatars2.githubusercontent.com/u/1089146?v=4","gravatar_id":"","url":"https://api.github.com/users/atom","html_url":"https://github.com/atom","followers_url":"https://api.github.com/users/atom/followers","following_url":"https://api.github.com/users/atom/following{/other_user}","gists_url":"https://api.github.com/users/atom/gists{/gist_id}","starred_url":"https://api.github.com/users/atom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atom/subscriptions","organizations_url":"https://api.github.com/users/atom/orgs","repos_url":"https://api.github.com/users/atom/repos","events_url":"https://api.github.com/users/atom/events{/privacy}","received_events_url":"https://api.github.com/users/atom/received_events","type":"Organization","site_admin":false},"repo":{"id":13712528,"name":"language-php","full_name":"atom/language-php","owner":{"login":"atom","id":1089146,"avatar_url":"https://avatars2.githubusercontent.com/u/1089146?v=4","gravatar_id":"","url":"https://api.github.com/users/atom","html_url":"https://github.com/atom","followers_url":"https://api.github.com/users/atom/followers","following_url":"https://api.github.com/users/atom/following{/other_user}","gists_url":"https://api.github.com/users/atom/gists{/gist_id}","starred_url":"https://api.github.com/users/atom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atom/subscriptions","organizations_url":"https://api.github.com/users/atom/orgs","repos_url":"https://api.github.com/users/atom/repos","events_url":"https://api.github.com/users/atom/events{/privacy}","received_events_url":"https://api.github.com/users/atom/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/atom/language-php","description":"PHP package for Atom","fork":false,"url":"https://api.github.com/repos/atom/language-php","forks_url":"https://api.github.com/repos/atom/language-php/forks","keys_url":"https://api.github.com/repos/atom/language-php/keys{/key_id}","collaborators_url":"https://api.github.com/repos/atom/language-php/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/atom/language-php/teams","hooks_url":"https://api.github.com/repos/atom/language-php/hooks","issue_events_url":"https://api.github.com/repos/atom/language-php/issues/events{/number}","events_url":"https://api.github.com/repos/atom/language-php/events","assignees_url":"https://api.github.com/repos/atom/language-php/assignees{/user}","branches_url":"https://api.github.com/repos/atom/language-php/branches{/branch}","tags_url":"https://api.github.com/repos/atom/language-php/tags","blobs_url":"https://api.github.com/repos/atom/language-php/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/atom/language-php/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/atom/language-php/git/refs{/sha}","trees_url":"https://api.github.com/repos/atom/language-php/git/trees{/sha}","statuses_url":"https://api.github.com/repos/atom/language-php/statuses/{sha}","languages_url":"https://api.github.com/repos/atom/language-php/languages","stargazers_url":"https://api.github.com/repos/atom/language-php/stargazers","contributors_url":"https://api.github.com/repos/atom/language-php/contributors","subscribers_url":"https://api.github.com/repos/atom/language-php/subscribers","subscription_url":"https://api.github.com/repos/atom/language-php/subscription","commits_url":"https://api.github.com/repos/atom/language-php/commits{/sha}","git_commits_url":"https://api.github.com/repos/atom/language-php/git/commits{/sha}","comments_url":"https://api.github.com/repos/atom/language-php/comments{/number}","issue_comment_url":"https://api.github.com/repos/atom/language-php/issues/comments{/number}","contents_url":"https://api.github.com/repos/atom/language-php/contents/{+path}","compare_url":"https://api.github.com/repos/atom/language-php/compare/{base}...{head}","merges_url":"https://api.github.com/repos/atom/language-php/merges","archive_url":"https://api.github.com/repos/atom/language-php/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/atom/language-php/downloads","issues_url":"https://api.github.com/repos/atom/language-php/issues{/number}","pulls_url":"https://api.github.com/repos/atom/language-php/pulls{/number}","milestones_url":"https://api.github.com/repos/atom/language-php/milestones{/number}","notifications_url":"https://api.github.com/repos/atom/language-php/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/atom/language-php/labels{/name}","releases_url":"https://api.github.com/repos/atom/language-php/releases{/id}","deployments_url":"https://api.github.com/repos/atom/language-php/deployments","created_at":"2013-10-20T02:41:16Z","updated_at":"2017-09-30T15:49:54Z","pushed_at":"2017-10-16T20:59:01Z","git_url":"git://github.com/atom/language-php.git","ssh_url":"git@github.com:atom/language-php.git","clone_url":"https://github.com/atom/language-php.git","svn_url":"https://github.com/atom/language-php","homepage":null,"size":896,"stargazers_count":97,"watchers_count":97,"language":"CoffeeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":84,"mirror_url":null,"open_issues_count":25,"forks":84,"open_issues":25,"watchers":97,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/atom/language-php/pulls/285"},"html":{"href":"https://github.com/atom/language-php/pull/285"},"issue":{"href":"https://api.github.com/repos/atom/language-php/issues/285"},"comments":{"href":"https://api.github.com/repos/atom/language-php/issues/285/comments"},"review_comments":{"href":"https://api.github.com/repos/atom/language-php/pulls/285/comments"},"review_comment":{"href":"https://api.github.com/repos/atom/language-php/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/atom/language-php/pulls/285/commits"},"statuses":{"href":"https://api.github.com/repos/atom/language-php/statuses/e27bf30c604ffeacc504ac36960ba76cd6bf4d8d"}},"author_association":"NONE"}}
{"actor":{"display_login":"dsifford"}}