{"action":"opened","issue":{"url":"https://api.github.com/repos/phpspec/prophecy/issues/214","labels_url":"https://api.github.com/repos/phpspec/prophecy/issues/214/labels{/name}","comments_url":"https://api.github.com/repos/phpspec/prophecy/issues/214/comments","events_url":"https://api.github.com/repos/phpspec/prophecy/issues/214/events","html_url":"https://github.com/phpspec/prophecy/issues/214","id":110675933,"number":214,"title":"Cyclic object graphs should be avoided if possible","user":{"login":"stof","id":439401,"avatar_url":"https://avatars.githubusercontent.com/u/439401?v=3","gravatar_id":"","url":"https://api.github.com/users/stof","html_url":"https://github.com/stof","followers_url":"https://api.github.com/users/stof/followers","following_url":"https://api.github.com/users/stof/following{/other_user}","gists_url":"https://api.github.com/users/stof/gists{/gist_id}","starred_url":"https://api.github.com/users/stof/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stof/subscriptions","organizations_url":"https://api.github.com/users/stof/orgs","repos_url":"https://api.github.com/users/stof/repos","events_url":"https://api.github.com/users/stof/events{/privacy}","received_events_url":"https://api.github.com/users/stof/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-10-09T14:58:29Z","updated_at":"2015-10-09T14:58:29Z","closed_at":null,"body":"Currently, we have many cyclic object graphs in Prophecy, meaning that we require the GC to enter into action rather than just refcount.\r\nThis can potentially have a big impact on testsuites as each double is used only for the duration of the test.\r\n\r\nWe should either find a way to get rid of cyclic graphs (not easy though as it requires an architecture change) or provide a method called during teardown to ask Prophecy to break all its cycles (putting the objects in an unusable state, but for a good reason).\r\n\r\nI identified a few cycles (list is not guaranteed to be exhaustive):\r\n\r\n- ObjectProphecy and MethodProphecy\r\n- ObjectProphecy, LazDouble and ProphecySubjectInterface (i.e. the double being created)"}}