{"action":"created","comment":{"url":"https://api.github.com/repos/laravel/framework/pulls/comments/45548390","id":45548390,"diff_hunk":"@@ -752,6 +791,96 @@ protected function compileEndpush($expression)\n     }\n \n     /**\n+     * Compile the inject annotations into valid PHP.\n+     *\n+     * @param  string[] $segments\n+     *\n+     * @return string\n+     */\n+    protected function compileInjectAnnotation(array $segments)\n+    {\n+        list($injectClass, $variableName) = $segments;\n+\n+        return '<?php '.$variableName.' = app('.$injectClass.'::class); ?>';\n+    }\n+\n+    /**\n+     * Compile the use annotations into valid PHP.\n+     *\n+     * @param  string[] $segments\n+     *\n+     * @return string\n+     */\n+    protected function compileUseAnnotation(array $segments)\n+    {\n+        return '<?php use '.implode(' ', $segments).'; ?>';\n+    }\n+\n+    /**\n+     * Compile the inject annotations into valid PHP.\n+     *\n+     * @param  string[] $segments\n+     *\n+     * @return string\n+     */\n+    protected function compileParamAnnotation(array $segments)\n+    {\n+        static $primitives = [","path":"src/Illuminate/View/Compilers/BladeCompiler.php","position":105,"original_position":105,"commit_id":"cce59f8830a52fb8d845f88a91e6a29d9e47ac10","original_commit_id":"cce59f8830a52fb8d845f88a91e6a29d9e47ac10","user":{"login":"GrahamCampbell","id":2829600,"avatar_url":"https://avatars.githubusercontent.com/u/2829600?v=3","gravatar_id":"","url":"https://api.github.com/users/GrahamCampbell","html_url":"https://github.com/GrahamCampbell","followers_url":"https://api.github.com/users/GrahamCampbell/followers","following_url":"https://api.github.com/users/GrahamCampbell/following{/other_user}","gists_url":"https://api.github.com/users/GrahamCampbell/gists{/gist_id}","starred_url":"https://api.github.com/users/GrahamCampbell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GrahamCampbell/subscriptions","organizations_url":"https://api.github.com/users/GrahamCampbell/orgs","repos_url":"https://api.github.com/users/GrahamCampbell/repos","events_url":"https://api.github.com/users/GrahamCampbell/events{/privacy}","received_events_url":"https://api.github.com/users/GrahamCampbell/received_events","type":"User","site_admin":false},"body":"missing primitives like `integer`, `real`, `boolean`","created_at":"2015-11-21T17:21:03Z","updated_at":"2015-11-21T17:21:03Z","html_url":"https://github.com/laravel/framework/pull/11049#discussion_r45548390","pull_request_url":"https://api.github.com/repos/laravel/framework/pulls/11049","_links":{"self":{"href":"https://api.github.com/repos/laravel/framework/pulls/comments/45548390"},"html":{"href":"https://github.com/laravel/framework/pull/11049#discussion_r45548390"},"pull_request":{"href":"https://api.github.com/repos/laravel/framework/pulls/11049"}}},"pull_request":{"url":"https://api.github.com/repos/laravel/framework/pulls/11049","id":51443877,"html_url":"https://github.com/laravel/framework/pull/11049","diff_url":"https://github.com/laravel/framework/pull/11049.diff","patch_url":"https://github.com/laravel/framework/pull/11049.patch","issue_url":"https://api.github.com/repos/laravel/framework/issues/11049","number":11049,"state":"open","locked":false,"title":"[5.3] Blade annotations","user":{"login":"TimeToogo","id":689898,"avatar_url":"https://avatars.githubusercontent.com/u/689898?v=3","gravatar_id":"","url":"https://api.github.com/users/TimeToogo","html_url":"https://github.com/TimeToogo","followers_url":"https://api.github.com/users/TimeToogo/followers","following_url":"https://api.github.com/users/TimeToogo/following{/other_user}","gists_url":"https://api.github.com/users/TimeToogo/gists{/gist_id}","starred_url":"https://api.github.com/users/TimeToogo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TimeToogo/subscriptions","organizations_url":"https://api.github.com/users/TimeToogo/orgs","repos_url":"https://api.github.com/users/TimeToogo/repos","events_url":"https://api.github.com/users/TimeToogo/events{/privacy}","received_events_url":"https://api.github.com/users/TimeToogo/received_events","type":"User","site_admin":false},"body":"Adds a similar syntax to PHPDoc annotations to the blade templating engine. These are similar blade directives except that the parenthesis are omitted and a single annotation *must* encompass an entire line. The original inspiration for this was adding `@param` annotation below, it feels as though it would mesh really well with the current blade syntax. They are designed to also benefit ide-integration.\r\n\r\n**`@param`**\r\n===========\r\nProvides a mechanism to implement strongly-typed views a la ASP .NET MVC. These are implemented to be syntactically identical to the typical `@param`'s in docblocks. The goal of this is to provide better debugging via explicit type information for view parameters.  Currently classes and primitive types are supported. Perhaps collections could be in the future scope?\r\n\r\n```blade\r\n{{-- $var must exist --}}\r\n@param $var\r\n\r\n{{-- $var must exist and be instance of SomeClass --}}\r\n@param SomeClass $var\r\n\r\n{{-- $var must exist and be an int --}}\r\n@param int $var\r\n\r\n{{-- $var must exist and be instance of SomeClass or null --}}\r\n@param SomeClass|null $var\r\n```\r\nIf any of the `@param` conditions fail, an exception of type `Illuminate\\View\\Exception\\ViewParamException` will be thrown.\r\n\r\n**`@use`**\r\n========\r\nEquivalent to PHP's `use` keyword, used for importing/aliasing namespaced class names.\r\n```blade\r\n@use Some\\Namespaced\\Class\r\n@use Some\\Namespaced\\Class as ClassAlias\r\n```\r\n\r\n**`@inject`**\r\n==========\r\nBehaves exactly like the current `@inject` directive, it is mainly a syntactical change. Instead of relying on strings to describe variables and class names, it has its own syntax matching the `@param` annotation.\r\n```blade\r\n{{-- equivalent to @inject('var', 'Some\\ClassName') --}}\r\n@inject Some\\ClassName $var\r\n```\r\nThis does not affect the current `@inject` syntax, as such code relying on the current syntax should remain unaffected.\r\n\r\nNotes\r\n=====\r\nDue to sharing syntax with current blade directives, there could be BC issues, but currently, to mitigate this, annotations forbid parenthesis and will fallback to standard directives if there is no implemented compiler for it. If this does not suffice perhaps an additional token could be added to the syntax to remove collisions.\r\n\r\nUsage\r\n=====\r\nHere is usage example of some annotations.\r\n\r\n```blade\r\n@param string $title\r\n@param bool $showSidebar\r\n<html>\r\n    <head>\r\n        <title>App Name - {{ $title }}</title>\r\n    </head>\r\n    <body>\r\n        @if($showSidebar)\r\n            @section('sidebar')\r\n                 This is the master sidebar.\r\n            @show\r\n        @endif\r\n\r\n        <div class=\"container\">\r\n            @yield('content')\r\n        </div>\r\n    </body>\r\n</html>\r\n```\r\n\r\nI am interested to get people's feedback on this idea.","created_at":"2015-11-21T15:57:25Z","updated_at":"2015-11-21T17:21:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"62abf4aae8b8fb09259e94bfa10fdf98acd6bb5f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/laravel/framework/pulls/11049/commits","review_comments_url":"https://api.github.com/repos/laravel/framework/pulls/11049/comments","review_comment_url":"https://api.github.com/repos/laravel/framework/pulls/comments{/number}","comments_url":"https://api.github.com/repos/laravel/framework/issues/11049/comments","statuses_url":"https://api.github.com/repos/laravel/framework/statuses/cce59f8830a52fb8d845f88a91e6a29d9e47ac10","head":{"label":"TimeToogo:master","ref":"master","sha":"cce59f8830a52fb8d845f88a91e6a29d9e47ac10","user":{"login":"TimeToogo","id":689898,"avatar_url":"https://avatars.githubusercontent.com/u/689898?v=3","gravatar_id":"","url":"https://api.github.com/users/TimeToogo","html_url":"https://github.com/TimeToogo","followers_url":"https://api.github.com/users/TimeToogo/followers","following_url":"https://api.github.com/users/TimeToogo/following{/other_user}","gists_url":"https://api.github.com/users/TimeToogo/gists{/gist_id}","starred_url":"https://api.github.com/users/TimeToogo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TimeToogo/subscriptions","organizations_url":"https://api.github.com/users/TimeToogo/orgs","repos_url":"https://api.github.com/users/TimeToogo/repos","events_url":"https://api.github.com/users/TimeToogo/events{/privacy}","received_events_url":"https://api.github.com/users/TimeToogo/received_events","type":"User","site_admin":false},"repo":{"id":46618640,"name":"framework","full_name":"TimeToogo/framework","owner":{"login":"TimeToogo","id":689898,"avatar_url":"https://avatars.githubusercontent.com/u/689898?v=3","gravatar_id":"","url":"https://api.github.com/users/TimeToogo","html_url":"https://github.com/TimeToogo","followers_url":"https://api.github.com/users/TimeToogo/followers","following_url":"https://api.github.com/users/TimeToogo/following{/other_user}","gists_url":"https://api.github.com/users/TimeToogo/gists{/gist_id}","starred_url":"https://api.github.com/users/TimeToogo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TimeToogo/subscriptions","organizations_url":"https://api.github.com/users/TimeToogo/orgs","repos_url":"https://api.github.com/users/TimeToogo/repos","events_url":"https://api.github.com/users/TimeToogo/events{/privacy}","received_events_url":"https://api.github.com/users/TimeToogo/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/TimeToogo/framework","description":"","fork":true,"url":"https://api.github.com/repos/TimeToogo/framework","forks_url":"https://api.github.com/repos/TimeToogo/framework/forks","keys_url":"https://api.github.com/repos/TimeToogo/framework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/TimeToogo/framework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/TimeToogo/framework/teams","hooks_url":"https://api.github.com/repos/TimeToogo/framework/hooks","issue_events_url":"https://api.github.com/repos/TimeToogo/framework/issues/events{/number}","events_url":"https://api.github.com/repos/TimeToogo/framework/events","assignees_url":"https://api.github.com/repos/TimeToogo/framework/assignees{/user}","branches_url":"https://api.github.com/repos/TimeToogo/framework/branches{/branch}","tags_url":"https://api.github.com/repos/TimeToogo/framework/tags","blobs_url":"https://api.github.com/repos/TimeToogo/framework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/TimeToogo/framework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/TimeToogo/framework/git/refs{/sha}","trees_url":"https://api.github.com/repos/TimeToogo/framework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/TimeToogo/framework/statuses/{sha}","languages_url":"https://api.github.com/repos/TimeToogo/framework/languages","stargazers_url":"https://api.github.com/repos/TimeToogo/framework/stargazers","contributors_url":"https://api.github.com/repos/TimeToogo/framework/contributors","subscribers_url":"https://api.github.com/repos/TimeToogo/framework/subscribers","subscription_url":"https://api.github.com/repos/TimeToogo/framework/subscription","commits_url":"https://api.github.com/repos/TimeToogo/framework/commits{/sha}","git_commits_url":"https://api.github.com/repos/TimeToogo/framework/git/commits{/sha}","comments_url":"https://api.github.com/repos/TimeToogo/framework/comments{/number}","issue_comment_url":"https://api.github.com/repos/TimeToogo/framework/issues/comments{/number}","contents_url":"https://api.github.com/repos/TimeToogo/framework/contents/{+path}","compare_url":"https://api.github.com/repos/TimeToogo/framework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/TimeToogo/framework/merges","archive_url":"https://api.github.com/repos/TimeToogo/framework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/TimeToogo/framework/downloads","issues_url":"https://api.github.com/repos/TimeToogo/framework/issues{/number}","pulls_url":"https://api.github.com/repos/TimeToogo/framework/pulls{/number}","milestones_url":"https://api.github.com/repos/TimeToogo/framework/milestones{/number}","notifications_url":"https://api.github.com/repos/TimeToogo/framework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/TimeToogo/framework/labels{/name}","releases_url":"https://api.github.com/repos/TimeToogo/framework/releases{/id}","created_at":"2015-11-21T14:29:44Z","updated_at":"2015-11-21T14:29:50Z","pushed_at":"2015-11-21T16:07:23Z","git_url":"git://github.com/TimeToogo/framework.git","ssh_url":"git@github.com:TimeToogo/framework.git","clone_url":"https://github.com/TimeToogo/framework.git","svn_url":"https://github.com/TimeToogo/framework","homepage":"http://laravel.com","size":19479,"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":"5.1"}},"base":{"label":"laravel:master","ref":"master","sha":"04bf242312396d94ff3fd5c2f073b0f27010a32a","user":{"login":"laravel","id":958072,"avatar_url":"https://avatars.githubusercontent.com/u/958072?v=3","gravatar_id":"","url":"https://api.github.com/users/laravel","html_url":"https://github.com/laravel","followers_url":"https://api.github.com/users/laravel/followers","following_url":"https://api.github.com/users/laravel/following{/other_user}","gists_url":"https://api.github.com/users/laravel/gists{/gist_id}","starred_url":"https://api.github.com/users/laravel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/laravel/subscriptions","organizations_url":"https://api.github.com/users/laravel/orgs","repos_url":"https://api.github.com/users/laravel/repos","events_url":"https://api.github.com/users/laravel/events{/privacy}","received_events_url":"https://api.github.com/users/laravel/received_events","type":"Organization","site_admin":false},"repo":{"id":7548986,"name":"framework","full_name":"laravel/framework","owner":{"login":"laravel","id":958072,"avatar_url":"https://avatars.githubusercontent.com/u/958072?v=3","gravatar_id":"","url":"https://api.github.com/users/laravel","html_url":"https://github.com/laravel","followers_url":"https://api.github.com/users/laravel/followers","following_url":"https://api.github.com/users/laravel/following{/other_user}","gists_url":"https://api.github.com/users/laravel/gists{/gist_id}","starred_url":"https://api.github.com/users/laravel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/laravel/subscriptions","organizations_url":"https://api.github.com/users/laravel/orgs","repos_url":"https://api.github.com/users/laravel/repos","events_url":"https://api.github.com/users/laravel/events{/privacy}","received_events_url":"https://api.github.com/users/laravel/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/laravel/framework","description":"","fork":false,"url":"https://api.github.com/repos/laravel/framework","forks_url":"https://api.github.com/repos/laravel/framework/forks","keys_url":"https://api.github.com/repos/laravel/framework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/laravel/framework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/laravel/framework/teams","hooks_url":"https://api.github.com/repos/laravel/framework/hooks","issue_events_url":"https://api.github.com/repos/laravel/framework/issues/events{/number}","events_url":"https://api.github.com/repos/laravel/framework/events","assignees_url":"https://api.github.com/repos/laravel/framework/assignees{/user}","branches_url":"https://api.github.com/repos/laravel/framework/branches{/branch}","tags_url":"https://api.github.com/repos/laravel/framework/tags","blobs_url":"https://api.github.com/repos/laravel/framework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/laravel/framework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/laravel/framework/git/refs{/sha}","trees_url":"https://api.github.com/repos/laravel/framework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/laravel/framework/statuses/{sha}","languages_url":"https://api.github.com/repos/laravel/framework/languages","stargazers_url":"https://api.github.com/repos/laravel/framework/stargazers","contributors_url":"https://api.github.com/repos/laravel/framework/contributors","subscribers_url":"https://api.github.com/repos/laravel/framework/subscribers","subscription_url":"https://api.github.com/repos/laravel/framework/subscription","commits_url":"https://api.github.com/repos/laravel/framework/commits{/sha}","git_commits_url":"https://api.github.com/repos/laravel/framework/git/commits{/sha}","comments_url":"https://api.github.com/repos/laravel/framework/comments{/number}","issue_comment_url":"https://api.github.com/repos/laravel/framework/issues/comments{/number}","contents_url":"https://api.github.com/repos/laravel/framework/contents/{+path}","compare_url":"https://api.github.com/repos/laravel/framework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/laravel/framework/merges","archive_url":"https://api.github.com/repos/laravel/framework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/laravel/framework/downloads","issues_url":"https://api.github.com/repos/laravel/framework/issues{/number}","pulls_url":"https://api.github.com/repos/laravel/framework/pulls{/number}","milestones_url":"https://api.github.com/repos/laravel/framework/milestones{/number}","notifications_url":"https://api.github.com/repos/laravel/framework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/laravel/framework/labels{/name}","releases_url":"https://api.github.com/repos/laravel/framework/releases{/id}","created_at":"2013-01-10T21:27:28Z","updated_at":"2015-11-21T13:43:47Z","pushed_at":"2015-11-21T16:07:23Z","git_url":"git://github.com/laravel/framework.git","ssh_url":"git@github.com:laravel/framework.git","clone_url":"https://github.com/laravel/framework.git","svn_url":"https://github.com/laravel/framework","homepage":"http://laravel.com","size":32167,"stargazers_count":4362,"watchers_count":4362,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2516,"mirror_url":null,"open_issues_count":86,"forks":2516,"open_issues":86,"watchers":4362,"default_branch":"5.1"}},"_links":{"self":{"href":"https://api.github.com/repos/laravel/framework/pulls/11049"},"html":{"href":"https://github.com/laravel/framework/pull/11049"},"issue":{"href":"https://api.github.com/repos/laravel/framework/issues/11049"},"comments":{"href":"https://api.github.com/repos/laravel/framework/issues/11049/comments"},"review_comments":{"href":"https://api.github.com/repos/laravel/framework/pulls/11049/comments"},"review_comment":{"href":"https://api.github.com/repos/laravel/framework/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/laravel/framework/pulls/11049/commits"},"statuses":{"href":"https://api.github.com/repos/laravel/framework/statuses/cce59f8830a52fb8d845f88a91e6a29d9e47ac10"}}}}