{"action":"created","comment":{"url":"https://api.github.com/repos/php-fig/fig-standards/pulls/comments/96280038","pull_request_review_id":16857656,"id":96280038,"diff_hunk":"@@ -275,38 +275,32 @@ However, most PHP-FIG members considered it to be a best practice. Base exceptio\n \n A call to the `get` method with a non-existing id must throw an exception implementing the `Psr\\Container\\NotFoundExceptionInterface`.\n \n-There is a strong relationship with the behaviour of the `has` method.\n-\n For a given identifier:\n \n - if the `has` method returns `false`, then the `get` method MUST throw a `Psr\\Container\\NotFoundExceptionInterface`.\n-- if the `has` method returns `true`, then the `get` method MUST NOT throw a `Psr\\Container\\NotFoundExceptionInterface`. However, this does not mean that the `get` method will succeed and throw no exception.\n+- if the `has` method returns `true`, this does not mean that the `get` method will succeed and throw no exception. It can even throw a `Psr\\Container\\NotFoundExceptionInterface` if one of the dependencies of the requested entry is missing.\n+\n+Therefore, when a user catches the `Psr\\Container\\NotFoundExceptionInterface`, it has 2 possibles meanings [[9]](#link_not_found_behaviour):","path":"proposed/container-meta.md","position":12,"original_position":12,"commit_id":"3b0d2bf45bf798fdb8364bc9fb7a063a68d6b3e9","original_commit_id":"3b0d2bf45bf798fdb8364bc9fb7a063a68d6b3e9","user":{"login":"kocsismate","id":6057627,"avatar_url":"https://avatars.githubusercontent.com/u/6057627?v=3","gravatar_id":"","url":"https://api.github.com/users/kocsismate","html_url":"https://github.com/kocsismate","followers_url":"https://api.github.com/users/kocsismate/followers","following_url":"https://api.github.com/users/kocsismate/following{/other_user}","gists_url":"https://api.github.com/users/kocsismate/gists{/gist_id}","starred_url":"https://api.github.com/users/kocsismate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kocsismate/subscriptions","organizations_url":"https://api.github.com/users/kocsismate/orgs","repos_url":"https://api.github.com/users/kocsismate/repos","events_url":"https://api.github.com/users/kocsismate/events{/privacy}","received_events_url":"https://api.github.com/users/kocsismate/received_events","type":"User","site_admin":false},"body":"I see French conjugation here :))) \"2 possibles meanings\"","created_at":"2017-01-16T17:57:22Z","updated_at":"2017-01-16T17:57:22Z","html_url":"https://github.com/php-fig/fig-standards/pull/869#discussion_r96280038","pull_request_url":"https://api.github.com/repos/php-fig/fig-standards/pulls/869","_links":{"self":{"href":"https://api.github.com/repos/php-fig/fig-standards/pulls/comments/96280038"},"html":{"href":"https://github.com/php-fig/fig-standards/pull/869#discussion_r96280038"},"pull_request":{"href":"https://api.github.com/repos/php-fig/fig-standards/pulls/869"}}},"pull_request":{"url":"https://api.github.com/repos/php-fig/fig-standards/pulls/869","id":101577895,"html_url":"https://github.com/php-fig/fig-standards/pull/869","diff_url":"https://github.com/php-fig/fig-standards/pull/869.diff","patch_url":"https://github.com/php-fig/fig-standards/pull/869.patch","issue_url":"https://api.github.com/repos/php-fig/fig-standards/issues/869","number":869,"state":"open","locked":false,"title":"[WIP] Reworking NotFoundExceptionInterface purpose","user":{"login":"moufmouf","id":1290952,"avatar_url":"https://avatars.githubusercontent.com/u/1290952?v=3","gravatar_id":"","url":"https://api.github.com/users/moufmouf","html_url":"https://github.com/moufmouf","followers_url":"https://api.github.com/users/moufmouf/followers","following_url":"https://api.github.com/users/moufmouf/following{/other_user}","gists_url":"https://api.github.com/users/moufmouf/gists{/gist_id}","starred_url":"https://api.github.com/users/moufmouf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moufmouf/subscriptions","organizations_url":"https://api.github.com/users/moufmouf/orgs","repos_url":"https://api.github.com/users/moufmouf/repos","events_url":"https://api.github.com/users/moufmouf/events{/privacy}","received_events_url":"https://api.github.com/users/moufmouf/received_events","type":"User","site_admin":false},"body":"Here is an attempt to solve the debate going on on the ML. More discussion needs to be done and meta needs to be fixed so do not merge this yet!\r\n\r\n@nicolas-grekas and @weierophinney mails ([here](https://groups.google.com/d/msg/php-fig/I1a2Xzv9wN8/Ja3ma6pWFQAJ) and [here](https://groups.google.com/d/msg/php-fig/I1a2Xzv9wN8/njO0oBZvFQAJ)) pointed a few things that were never said before.\r\n\r\nNamely:\r\n\r\n- The `NotFoundExceptionInterface` duplicates the concept of the `has` method (in Nicolas post)\r\n- Using exceptions for control flow is often a questionable design choice (in Matthew post)\r\n\r\nBased on these 2 assertions (I agree with both), we should question the usefulness of `NotFoundExceptionInterface` as it is defined today.\r\n\r\nWe spent a lot of time to make sure that containers implementing PSR-11 are differentiating the `NotFoundExceptionInterface` from a \"missing dependency exception\" (that should exist in the container even if it is not standardized). This involves that implementing containers MUST catch the `NotFoundExceptionInterface` and rethrow another exception. So we are forcing an \"implementation detail\" into implementors.\r\n\r\nAnd I've come to realize we absolutely don't need that.\r\n\r\nThe change I'm proposing is dead simple: let's drop any distinction between \"entry not found\" and \"dependency missing\". We don't need this because users of containers can anyway figure that out.\r\n\r\nIf a user of a container wants to make the distinction between \"not found\" and \"missing dependency\", he can simply perform a call to `has` before calling `get`:\r\n\r\n```php\r\nif (!$container->has($id)) {\r\n    // The requested instance does not exist\r\n    // Let's do some stuff like display an error message\r\n    return;\r\n}\r\ntry {\r\n    $entry = $container->get($id);\r\n} catch (NotFoundExceptionInterface $e) {\r\n    // Since the requested entry DOES exist, a NotFoundExceptionInterface means that a dependency is missing!\r\n}\r\n```\r\n\r\nAdvantages:\r\n\r\n- it is dead simple\r\n- we don't dictate that `NotFoundExceptionInterface` must not bubble up (no forced catch and rethrow)\r\n- containers can do whatever they want:\r\n    - either let `NotFoundExceptionInterface` bubble up\r\n    - or catch the `NotFoundExceptionInterface` and wrap it in a \"MissingDependencyException\" of their own that must itself implement the `NotFoundExceptionInterface`\r\n\r\nInconvenient:\r\n\r\n- slight incompatibility with container-interop, since in container-interop, the  \"MissingDependencyException\" was not supposed to implement the `NotFoundExceptionInterface` (this is actually not clearly stated in the container-interop documentation)\r\n\r\nThe more I think about it, the more I'm seduced by this solution. It is simple, it leaves complete freedom to implementors, and container users can still figure out if the exception they get is a \"not found\" or a \"missing dependency\" with a simple `has` call. It also enforces best practices as users that want to check if an entry exists will use `has` instead of `NotFoundExceptionInterface` (the exception can no more be used for control flow)\r\n\r\nNote: I haven't had a chance to speak with @mnapoli about it yet since deadlines are tight, I'm sharing it right now. Matthieu, let me know what you think about this change.\r\n\r\nWhat do you think?","created_at":"2017-01-14T23:02:56Z","updated_at":"2017-01-16T17:57:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d6c620c9b321543d49a8141d803858ad6b4d669e","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/php-fig/fig-standards/pulls/869/commits","review_comments_url":"https://api.github.com/repos/php-fig/fig-standards/pulls/869/comments","review_comment_url":"https://api.github.com/repos/php-fig/fig-standards/pulls/comments{/number}","comments_url":"https://api.github.com/repos/php-fig/fig-standards/issues/869/comments","statuses_url":"https://api.github.com/repos/php-fig/fig-standards/statuses/3b0d2bf45bf798fdb8364bc9fb7a063a68d6b3e9","head":{"label":"moufmouf:one_unique_notfound","ref":"one_unique_notfound","sha":"3b0d2bf45bf798fdb8364bc9fb7a063a68d6b3e9","user":{"login":"moufmouf","id":1290952,"avatar_url":"https://avatars.githubusercontent.com/u/1290952?v=3","gravatar_id":"","url":"https://api.github.com/users/moufmouf","html_url":"https://github.com/moufmouf","followers_url":"https://api.github.com/users/moufmouf/followers","following_url":"https://api.github.com/users/moufmouf/following{/other_user}","gists_url":"https://api.github.com/users/moufmouf/gists{/gist_id}","starred_url":"https://api.github.com/users/moufmouf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moufmouf/subscriptions","organizations_url":"https://api.github.com/users/moufmouf/orgs","repos_url":"https://api.github.com/users/moufmouf/repos","events_url":"https://api.github.com/users/moufmouf/events{/privacy}","received_events_url":"https://api.github.com/users/moufmouf/received_events","type":"User","site_admin":false},"repo":{"id":12245783,"name":"fig-standards","full_name":"moufmouf/fig-standards","owner":{"login":"moufmouf","id":1290952,"avatar_url":"https://avatars.githubusercontent.com/u/1290952?v=3","gravatar_id":"","url":"https://api.github.com/users/moufmouf","html_url":"https://github.com/moufmouf","followers_url":"https://api.github.com/users/moufmouf/followers","following_url":"https://api.github.com/users/moufmouf/following{/other_user}","gists_url":"https://api.github.com/users/moufmouf/gists{/gist_id}","starred_url":"https://api.github.com/users/moufmouf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moufmouf/subscriptions","organizations_url":"https://api.github.com/users/moufmouf/orgs","repos_url":"https://api.github.com/users/moufmouf/repos","events_url":"https://api.github.com/users/moufmouf/events{/privacy}","received_events_url":"https://api.github.com/users/moufmouf/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/moufmouf/fig-standards","description":"Standards either proposed or approved by the Framework Interop Group","fork":true,"url":"https://api.github.com/repos/moufmouf/fig-standards","forks_url":"https://api.github.com/repos/moufmouf/fig-standards/forks","keys_url":"https://api.github.com/repos/moufmouf/fig-standards/keys{/key_id}","collaborators_url":"https://api.github.com/repos/moufmouf/fig-standards/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/moufmouf/fig-standards/teams","hooks_url":"https://api.github.com/repos/moufmouf/fig-standards/hooks","issue_events_url":"https://api.github.com/repos/moufmouf/fig-standards/issues/events{/number}","events_url":"https://api.github.com/repos/moufmouf/fig-standards/events","assignees_url":"https://api.github.com/repos/moufmouf/fig-standards/assignees{/user}","branches_url":"https://api.github.com/repos/moufmouf/fig-standards/branches{/branch}","tags_url":"https://api.github.com/repos/moufmouf/fig-standards/tags","blobs_url":"https://api.github.com/repos/moufmouf/fig-standards/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/moufmouf/fig-standards/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/moufmouf/fig-standards/git/refs{/sha}","trees_url":"https://api.github.com/repos/moufmouf/fig-standards/git/trees{/sha}","statuses_url":"https://api.github.com/repos/moufmouf/fig-standards/statuses/{sha}","languages_url":"https://api.github.com/repos/moufmouf/fig-standards/languages","stargazers_url":"https://api.github.com/repos/moufmouf/fig-standards/stargazers","contributors_url":"https://api.github.com/repos/moufmouf/fig-standards/contributors","subscribers_url":"https://api.github.com/repos/moufmouf/fig-standards/subscribers","subscription_url":"https://api.github.com/repos/moufmouf/fig-standards/subscription","commits_url":"https://api.github.com/repos/moufmouf/fig-standards/commits{/sha}","git_commits_url":"https://api.github.com/repos/moufmouf/fig-standards/git/commits{/sha}","comments_url":"https://api.github.com/repos/moufmouf/fig-standards/comments{/number}","issue_comment_url":"https://api.github.com/repos/moufmouf/fig-standards/issues/comments{/number}","contents_url":"https://api.github.com/repos/moufmouf/fig-standards/contents/{+path}","compare_url":"https://api.github.com/repos/moufmouf/fig-standards/compare/{base}...{head}","merges_url":"https://api.github.com/repos/moufmouf/fig-standards/merges","archive_url":"https://api.github.com/repos/moufmouf/fig-standards/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/moufmouf/fig-standards/downloads","issues_url":"https://api.github.com/repos/moufmouf/fig-standards/issues{/number}","pulls_url":"https://api.github.com/repos/moufmouf/fig-standards/pulls{/number}","milestones_url":"https://api.github.com/repos/moufmouf/fig-standards/milestones{/number}","notifications_url":"https://api.github.com/repos/moufmouf/fig-standards/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/moufmouf/fig-standards/labels{/name}","releases_url":"https://api.github.com/repos/moufmouf/fig-standards/releases{/id}","deployments_url":"https://api.github.com/repos/moufmouf/fig-standards/deployments","created_at":"2013-08-20T14:54:06Z","updated_at":"2015-08-28T15:48:59Z","pushed_at":"2017-01-16T17:29:27Z","git_url":"git://github.com/moufmouf/fig-standards.git","ssh_url":"git@github.com:moufmouf/fig-standards.git","clone_url":"https://github.com/moufmouf/fig-standards.git","svn_url":"https://github.com/moufmouf/fig-standards","homepage":"http://www.php-fig.org/","size":2281,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"psr11"}},"base":{"label":"php-fig:master","ref":"master","sha":"adec7819a6fca1f1a9d4a688e9aba540e242ab51","user":{"login":"php-fig","id":468401,"avatar_url":"https://avatars.githubusercontent.com/u/468401?v=3","gravatar_id":"","url":"https://api.github.com/users/php-fig","html_url":"https://github.com/php-fig","followers_url":"https://api.github.com/users/php-fig/followers","following_url":"https://api.github.com/users/php-fig/following{/other_user}","gists_url":"https://api.github.com/users/php-fig/gists{/gist_id}","starred_url":"https://api.github.com/users/php-fig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/php-fig/subscriptions","organizations_url":"https://api.github.com/users/php-fig/orgs","repos_url":"https://api.github.com/users/php-fig/repos","events_url":"https://api.github.com/users/php-fig/events{/privacy}","received_events_url":"https://api.github.com/users/php-fig/received_events","type":"Organization","site_admin":false},"repo":{"id":1053270,"name":"fig-standards","full_name":"php-fig/fig-standards","owner":{"login":"php-fig","id":468401,"avatar_url":"https://avatars.githubusercontent.com/u/468401?v=3","gravatar_id":"","url":"https://api.github.com/users/php-fig","html_url":"https://github.com/php-fig","followers_url":"https://api.github.com/users/php-fig/followers","following_url":"https://api.github.com/users/php-fig/following{/other_user}","gists_url":"https://api.github.com/users/php-fig/gists{/gist_id}","starred_url":"https://api.github.com/users/php-fig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/php-fig/subscriptions","organizations_url":"https://api.github.com/users/php-fig/orgs","repos_url":"https://api.github.com/users/php-fig/repos","events_url":"https://api.github.com/users/php-fig/events{/privacy}","received_events_url":"https://api.github.com/users/php-fig/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/php-fig/fig-standards","description":"Standards either proposed or approved by the Framework Interop Group","fork":false,"url":"https://api.github.com/repos/php-fig/fig-standards","forks_url":"https://api.github.com/repos/php-fig/fig-standards/forks","keys_url":"https://api.github.com/repos/php-fig/fig-standards/keys{/key_id}","collaborators_url":"https://api.github.com/repos/php-fig/fig-standards/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/php-fig/fig-standards/teams","hooks_url":"https://api.github.com/repos/php-fig/fig-standards/hooks","issue_events_url":"https://api.github.com/repos/php-fig/fig-standards/issues/events{/number}","events_url":"https://api.github.com/repos/php-fig/fig-standards/events","assignees_url":"https://api.github.com/repos/php-fig/fig-standards/assignees{/user}","branches_url":"https://api.github.com/repos/php-fig/fig-standards/branches{/branch}","tags_url":"https://api.github.com/repos/php-fig/fig-standards/tags","blobs_url":"https://api.github.com/repos/php-fig/fig-standards/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/php-fig/fig-standards/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/php-fig/fig-standards/git/refs{/sha}","trees_url":"https://api.github.com/repos/php-fig/fig-standards/git/trees{/sha}","statuses_url":"https://api.github.com/repos/php-fig/fig-standards/statuses/{sha}","languages_url":"https://api.github.com/repos/php-fig/fig-standards/languages","stargazers_url":"https://api.github.com/repos/php-fig/fig-standards/stargazers","contributors_url":"https://api.github.com/repos/php-fig/fig-standards/contributors","subscribers_url":"https://api.github.com/repos/php-fig/fig-standards/subscribers","subscription_url":"https://api.github.com/repos/php-fig/fig-standards/subscription","commits_url":"https://api.github.com/repos/php-fig/fig-standards/commits{/sha}","git_commits_url":"https://api.github.com/repos/php-fig/fig-standards/git/commits{/sha}","comments_url":"https://api.github.com/repos/php-fig/fig-standards/comments{/number}","issue_comment_url":"https://api.github.com/repos/php-fig/fig-standards/issues/comments{/number}","contents_url":"https://api.github.com/repos/php-fig/fig-standards/contents/{+path}","compare_url":"https://api.github.com/repos/php-fig/fig-standards/compare/{base}...{head}","merges_url":"https://api.github.com/repos/php-fig/fig-standards/merges","archive_url":"https://api.github.com/repos/php-fig/fig-standards/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/php-fig/fig-standards/downloads","issues_url":"https://api.github.com/repos/php-fig/fig-standards/issues{/number}","pulls_url":"https://api.github.com/repos/php-fig/fig-standards/pulls{/number}","milestones_url":"https://api.github.com/repos/php-fig/fig-standards/milestones{/number}","notifications_url":"https://api.github.com/repos/php-fig/fig-standards/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/php-fig/fig-standards/labels{/name}","releases_url":"https://api.github.com/repos/php-fig/fig-standards/releases{/id}","deployments_url":"https://api.github.com/repos/php-fig/fig-standards/deployments","created_at":"2010-11-05T04:44:12Z","updated_at":"2017-01-16T17:46:56Z","pushed_at":"2017-01-16T17:29:30Z","git_url":"git://github.com/php-fig/fig-standards.git","ssh_url":"git@github.com:php-fig/fig-standards.git","clone_url":"https://github.com/php-fig/fig-standards.git","svn_url":"https://github.com/php-fig/fig-standards","homepage":"http://www.php-fig.org/","size":2232,"stargazers_count":8662,"watchers_count":8662,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2313,"mirror_url":null,"open_issues_count":30,"forks":2313,"open_issues":30,"watchers":8662,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/php-fig/fig-standards/pulls/869"},"html":{"href":"https://github.com/php-fig/fig-standards/pull/869"},"issue":{"href":"https://api.github.com/repos/php-fig/fig-standards/issues/869"},"comments":{"href":"https://api.github.com/repos/php-fig/fig-standards/issues/869/comments"},"review_comments":{"href":"https://api.github.com/repos/php-fig/fig-standards/pulls/869/comments"},"review_comment":{"href":"https://api.github.com/repos/php-fig/fig-standards/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/php-fig/fig-standards/pulls/869/commits"},"statuses":{"href":"https://api.github.com/repos/php-fig/fig-standards/statuses/3b0d2bf45bf798fdb8364bc9fb7a063a68d6b3e9"}}}}
{"actor":{"display_login":"kocsismate"}}