{"action":"created","issue":{"url":"https://api.github.com/repos/thephpleague/container/issues/111","repository_url":"https://api.github.com/repos/thephpleague/container","labels_url":"https://api.github.com/repos/thephpleague/container/issues/111/labels{/name}","comments_url":"https://api.github.com/repos/thephpleague/container/issues/111/comments","events_url":"https://api.github.com/repos/thephpleague/container/issues/111/events","html_url":"https://github.com/thephpleague/container/issues/111","id":162735722,"number":111,"title":"Impossible to override shared service if already resolved","user":{"login":"Anahkiasen","id":1321596,"avatar_url":"https://avatars.githubusercontent.com/u/1321596?v=3","gravatar_id":"","url":"https://api.github.com/users/Anahkiasen","html_url":"https://github.com/Anahkiasen","followers_url":"https://api.github.com/users/Anahkiasen/followers","following_url":"https://api.github.com/users/Anahkiasen/following{/other_user}","gists_url":"https://api.github.com/users/Anahkiasen/gists{/gist_id}","starred_url":"https://api.github.com/users/Anahkiasen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Anahkiasen/subscriptions","organizations_url":"https://api.github.com/users/Anahkiasen/orgs","repos_url":"https://api.github.com/users/Anahkiasen/repos","events_url":"https://api.github.com/users/Anahkiasen/events{/privacy}","received_events_url":"https://api.github.com/users/Anahkiasen/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-06-28T16:59:37Z","updated_at":"2016-06-29T15:01:40Z","closed_at":null,"body":"I'm not sure if this is a bug or intended behavior so bear with me. If I share a value in the container, I am properly able to overwrite it:\r\n\r\n```php\r\n$container = new League\\Container\\Container();\r\n\r\n$container->share('foo', 'bar');\r\ndump($container->get('foo')); // bar\r\n\r\n$container->share('foo', 'baz');\r\ndump($container->get('foo')); // baz\r\n```\r\n\r\nIf however I share a factory, I can't overwrite it:\r\n\r\n```php\r\n$container = new League\\Container\\Container();\r\n\r\n$container->share('foo', function() {\r\n    return 'bar';\r\n});\r\ndump($container->get('foo'));// bar\r\n\r\n$container->share('foo', function() {\r\n    return 'baz';\r\n});\r\ndump($container->get('foo')); // bar\r\n```\r\n\r\nReason seems to be the container looks in `$this->shared` the second time even though the definition has changed, and thus it returns the resolved value. Shouldn't the resolved value be cleared when the definition changes?"},"comment":{"url":"https://api.github.com/repos/thephpleague/container/issues/comments/229384350","html_url":"https://github.com/thephpleague/container/issues/111#issuecomment-229384350","issue_url":"https://api.github.com/repos/thephpleague/container/issues/111","id":229384350,"user":{"login":"Anahkiasen","id":1321596,"avatar_url":"https://avatars.githubusercontent.com/u/1321596?v=3","gravatar_id":"","url":"https://api.github.com/users/Anahkiasen","html_url":"https://github.com/Anahkiasen","followers_url":"https://api.github.com/users/Anahkiasen/followers","following_url":"https://api.github.com/users/Anahkiasen/following{/other_user}","gists_url":"https://api.github.com/users/Anahkiasen/gists{/gist_id}","starred_url":"https://api.github.com/users/Anahkiasen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Anahkiasen/subscriptions","organizations_url":"https://api.github.com/users/Anahkiasen/orgs","repos_url":"https://api.github.com/users/Anahkiasen/repos","events_url":"https://api.github.com/users/Anahkiasen/events{/privacy}","received_events_url":"https://api.github.com/users/Anahkiasen/received_events","type":"User","site_admin":false},"created_at":"2016-06-29T15:01:40Z","updated_at":"2016-06-29T15:01:40Z","body":"I would personally consider this a BC break, some people might have been relying on that behavior in some ways, thinking it was intended."}}
{"actor":{"display_login":"Anahkiasen"}}