{"action":"created","comment":{"url":"https://api.github.com/repos/symfony/symfony/pulls/comments/57434852","id":57434852,"diff_hunk":"@@ -0,0 +1,40 @@\n+<?php\n+\n+/*\n+ * This file is part of the Symfony package.\n+ *\n+ * (c) Fabien Potencier <fabien@symfony.com>\n+ *\n+ * For the full copyright and license information, please view the LICENSE\n+ * file that was distributed with this source code.\n+ */\n+\n+namespace Symfony\\Component\\HttpKernel\\Controller\\ArgumentValueResolver;\n+\n+use Symfony\\Component\\HttpFoundation\\Request;\n+use Symfony\\Component\\HttpKernel\\Controller\\ArgumentValueResolverInterface;\n+use Symfony\\Component\\HttpKernel\\ControllerMetadata\\Argument\\ArgumentMetadataInterface;\n+\n+/**\n+ * Supports the same instance as the request object passed along.\n+ *\n+ * @author Iltar van der Berg <kjarli@gmail.com>\n+ */\n+final class ArgumentIsRequest implements ArgumentValueResolverInterface\n+{\n+    /**\n+     * {@inheritdoc}\n+     */\n+    public function supports(Request $request, ArgumentMetadataInterface $argument)\n+    {\n+        return $argument->getArgumentType() === get_class($request);","path":"src/Symfony/Component/HttpKernel/Controller/ArgumentValueResolver/ArgumentIsRequest.php","position":30,"original_position":30,"commit_id":"c341ac558d746996b76925274b6e0af213b8d963","original_commit_id":"c341ac558d746996b76925274b6e0af213b8d963","user":{"login":"iltar","id":1754678,"avatar_url":"https://avatars.githubusercontent.com/u/1754678?v=3","gravatar_id":"","url":"https://api.github.com/users/iltar","html_url":"https://github.com/iltar","followers_url":"https://api.github.com/users/iltar/followers","following_url":"https://api.github.com/users/iltar/following{/other_user}","gists_url":"https://api.github.com/users/iltar/gists{/gist_id}","starred_url":"https://api.github.com/users/iltar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iltar/subscriptions","organizations_url":"https://api.github.com/users/iltar/orgs","repos_url":"https://api.github.com/users/iltar/repos","events_url":"https://api.github.com/users/iltar/events{/privacy}","received_events_url":"https://api.github.com/users/iltar/received_events","type":"User","site_admin":false},"body":"The current check is doing an instanceof check via reflection. I agree that your solution might provide a more secure check. Changing it to:\r\n```php\r\nreturn $argument->getArgumentType() === Request::class || is_subclass_of($request, $argument->getArgumentType());\r\n```","created_at":"2016-03-25T10:42:23Z","updated_at":"2016-03-25T10:42:23Z","html_url":"https://github.com/symfony/symfony/pull/18308#discussion_r57434852","pull_request_url":"https://api.github.com/repos/symfony/symfony/pulls/18308","_links":{"self":{"href":"https://api.github.com/repos/symfony/symfony/pulls/comments/57434852"},"html":{"href":"https://github.com/symfony/symfony/pull/18308#discussion_r57434852"},"pull_request":{"href":"https://api.github.com/repos/symfony/symfony/pulls/18308"}}},"pull_request":{"url":"https://api.github.com/repos/symfony/symfony/pulls/18308","id":64150123,"html_url":"https://github.com/symfony/symfony/pull/18308","diff_url":"https://github.com/symfony/symfony/pull/18308.diff","patch_url":"https://github.com/symfony/symfony/pull/18308.patch","issue_url":"https://api.github.com/repos/symfony/symfony/issues/18308","number":18308,"state":"open","locked":false,"title":"Added an ArgumentResolver with clean extension point","user":{"login":"iltar","id":1754678,"avatar_url":"https://avatars.githubusercontent.com/u/1754678?v=3","gravatar_id":"","url":"https://api.github.com/users/iltar","html_url":"https://github.com/iltar","followers_url":"https://api.github.com/users/iltar/followers","following_url":"https://api.github.com/users/iltar/following{/other_user}","gists_url":"https://api.github.com/users/iltar/gists{/gist_id}","starred_url":"https://api.github.com/users/iltar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iltar/subscriptions","organizations_url":"https://api.github.com/users/iltar/orgs","repos_url":"https://api.github.com/users/iltar/repos","events_url":"https://api.github.com/users/iltar/events{/privacy}","received_events_url":"https://api.github.com/users/iltar/received_events","type":"User","site_admin":false},"body":"| Q             | A\r\n| ------------- | ---\r\n| Branch?       | master\r\n| Bug fix?      | no\r\n| New feature?  | yes\r\n| BC breaks?    | no\r\n| Deprecations? | yes\r\n| Tests pass?   | yes\r\n| Fixed tickets | #17933 (pre-work), #1547, #10710\r\n| License       | MIT\r\n| Doc PR        | ~\r\n\r\n**This PR is a follow up for and blocked by: #18187**, relates to #11457 by @WouterJ. When reviewing, please take the last commit: [Added an ArgumentResolver with clean extension point](https://github.com/symfony/symfony/pull/18308/commits/c341ac558d746996b76925274b6e0af213b8d963)\r\n\r\nThis PR provides:\r\n- The ability to tag your own `ArgumentValueResolverInterface`. This means that you can effectively expand on the argument resolving in the `HttpKernel` without having to implement your own `ArgumentResolver`.\r\n\r\n- The possibility to cache away argument metadata via a new `ArgumentMetadataFactory` which simply fetches the data from the cache, effectively omitting 1 reflection call per request. *Not implemented in this PR, but possible once this is merged.*\r\n\r\n- The possibility to add a PSR-7 adapter to resolve the correct request, avoids the paramconverters\r\n- The possibility to add a value resolver to fetch stuff from $request->query\r\n- Drupal could simplify [their argument resolving](https://github.com/drupal/drupal/blob/8.1.x/core/lib/Drupal/Core/Controller/ControllerResolver.php) by a lot\r\n- etc.\r\n\r\nThe aim for this PR is to provide a 100% BC variant to add argument resolving in a clean way, this is shown by the 2 tests: `LegacyArgumentResolverTest` and `ArgumentResolverTest`. \r\n\r\n/cc @dawehner @larowlan if you have time, can you check the impact for Drupal? I think this should be a very simple change which should make it more maintainable. ","created_at":"2016-03-25T10:25:01Z","updated_at":"2016-03-25T10:42:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"79aa1d28dc867db84862d0c4c3ce429505b24dba","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/symfony/symfony/pulls/18308/commits","review_comments_url":"https://api.github.com/repos/symfony/symfony/pulls/18308/comments","review_comment_url":"https://api.github.com/repos/symfony/symfony/pulls/comments{/number}","comments_url":"https://api.github.com/repos/symfony/symfony/issues/18308/comments","statuses_url":"https://api.github.com/repos/symfony/symfony/statuses/c341ac558d746996b76925274b6e0af213b8d963","head":{"label":"iltar:feature/argument-resolver-extention-point","ref":"feature/argument-resolver-extention-point","sha":"c341ac558d746996b76925274b6e0af213b8d963","user":{"login":"iltar","id":1754678,"avatar_url":"https://avatars.githubusercontent.com/u/1754678?v=3","gravatar_id":"","url":"https://api.github.com/users/iltar","html_url":"https://github.com/iltar","followers_url":"https://api.github.com/users/iltar/followers","following_url":"https://api.github.com/users/iltar/following{/other_user}","gists_url":"https://api.github.com/users/iltar/gists{/gist_id}","starred_url":"https://api.github.com/users/iltar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iltar/subscriptions","organizations_url":"https://api.github.com/users/iltar/orgs","repos_url":"https://api.github.com/users/iltar/repos","events_url":"https://api.github.com/users/iltar/events{/privacy}","received_events_url":"https://api.github.com/users/iltar/received_events","type":"User","site_admin":false},"repo":{"id":7439250,"name":"symfony","full_name":"iltar/symfony","owner":{"login":"iltar","id":1754678,"avatar_url":"https://avatars.githubusercontent.com/u/1754678?v=3","gravatar_id":"","url":"https://api.github.com/users/iltar","html_url":"https://github.com/iltar","followers_url":"https://api.github.com/users/iltar/followers","following_url":"https://api.github.com/users/iltar/following{/other_user}","gists_url":"https://api.github.com/users/iltar/gists{/gist_id}","starred_url":"https://api.github.com/users/iltar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iltar/subscriptions","organizations_url":"https://api.github.com/users/iltar/orgs","repos_url":"https://api.github.com/users/iltar/repos","events_url":"https://api.github.com/users/iltar/events{/privacy}","received_events_url":"https://api.github.com/users/iltar/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/iltar/symfony","description":"The Symfony PHP framework","fork":true,"url":"https://api.github.com/repos/iltar/symfony","forks_url":"https://api.github.com/repos/iltar/symfony/forks","keys_url":"https://api.github.com/repos/iltar/symfony/keys{/key_id}","collaborators_url":"https://api.github.com/repos/iltar/symfony/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/iltar/symfony/teams","hooks_url":"https://api.github.com/repos/iltar/symfony/hooks","issue_events_url":"https://api.github.com/repos/iltar/symfony/issues/events{/number}","events_url":"https://api.github.com/repos/iltar/symfony/events","assignees_url":"https://api.github.com/repos/iltar/symfony/assignees{/user}","branches_url":"https://api.github.com/repos/iltar/symfony/branches{/branch}","tags_url":"https://api.github.com/repos/iltar/symfony/tags","blobs_url":"https://api.github.com/repos/iltar/symfony/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/iltar/symfony/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/iltar/symfony/git/refs{/sha}","trees_url":"https://api.github.com/repos/iltar/symfony/git/trees{/sha}","statuses_url":"https://api.github.com/repos/iltar/symfony/statuses/{sha}","languages_url":"https://api.github.com/repos/iltar/symfony/languages","stargazers_url":"https://api.github.com/repos/iltar/symfony/stargazers","contributors_url":"https://api.github.com/repos/iltar/symfony/contributors","subscribers_url":"https://api.github.com/repos/iltar/symfony/subscribers","subscription_url":"https://api.github.com/repos/iltar/symfony/subscription","commits_url":"https://api.github.com/repos/iltar/symfony/commits{/sha}","git_commits_url":"https://api.github.com/repos/iltar/symfony/git/commits{/sha}","comments_url":"https://api.github.com/repos/iltar/symfony/comments{/number}","issue_comment_url":"https://api.github.com/repos/iltar/symfony/issues/comments{/number}","contents_url":"https://api.github.com/repos/iltar/symfony/contents/{+path}","compare_url":"https://api.github.com/repos/iltar/symfony/compare/{base}...{head}","merges_url":"https://api.github.com/repos/iltar/symfony/merges","archive_url":"https://api.github.com/repos/iltar/symfony/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/iltar/symfony/downloads","issues_url":"https://api.github.com/repos/iltar/symfony/issues{/number}","pulls_url":"https://api.github.com/repos/iltar/symfony/pulls{/number}","milestones_url":"https://api.github.com/repos/iltar/symfony/milestones{/number}","notifications_url":"https://api.github.com/repos/iltar/symfony/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/iltar/symfony/labels{/name}","releases_url":"https://api.github.com/repos/iltar/symfony/releases{/id}","deployments_url":"https://api.github.com/repos/iltar/symfony/deployments","created_at":"2013-01-04T11:22:34Z","updated_at":"2015-02-06T10:55:28Z","pushed_at":"2016-03-25T10:27:19Z","git_url":"git://github.com/iltar/symfony.git","ssh_url":"git@github.com:iltar/symfony.git","clone_url":"https://github.com/iltar/symfony.git","svn_url":"https://github.com/iltar/symfony","homepage":"symfony.com","size":69761,"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:master","ref":"master","sha":"3598105da9375b5bff89b1b63ce0d247867c70a0","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}","deployments_url":"https://api.github.com/repos/symfony/symfony/deployments","created_at":"2010-01-04T14:21:21Z","updated_at":"2016-03-25T04:01:11Z","pushed_at":"2016-03-25T10:27:20Z","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":104777,"stargazers_count":11991,"watchers_count":11991,"language":"PHP","has_issues":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":4724,"mirror_url":null,"open_issues_count":721,"forks":4724,"open_issues":721,"watchers":11991,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/symfony/symfony/pulls/18308"},"html":{"href":"https://github.com/symfony/symfony/pull/18308"},"issue":{"href":"https://api.github.com/repos/symfony/symfony/issues/18308"},"comments":{"href":"https://api.github.com/repos/symfony/symfony/issues/18308/comments"},"review_comments":{"href":"https://api.github.com/repos/symfony/symfony/pulls/18308/comments"},"review_comment":{"href":"https://api.github.com/repos/symfony/symfony/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/symfony/symfony/pulls/18308/commits"},"statuses":{"href":"https://api.github.com/repos/symfony/symfony/statuses/c341ac558d746996b76925274b6e0af213b8d963"}}}}