{"action":"opened","issue":{"url":"https://api.github.com/repos/goaop/parser-reflection/issues/2","labels_url":"https://api.github.com/repos/goaop/parser-reflection/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/goaop/parser-reflection/issues/2/comments","events_url":"https://api.github.com/repos/goaop/parser-reflection/issues/2/events","html_url":"https://github.com/goaop/parser-reflection/issues/2","id":120577510,"number":2,"title":"Injected factory instead of explicit \"new X()\" ?","user":{"login":"donquixote","id":150032,"avatar_url":"https://avatars.githubusercontent.com/u/150032?v=3","gravatar_id":"","url":"https://api.github.com/users/donquixote","html_url":"https://github.com/donquixote","followers_url":"https://api.github.com/users/donquixote/followers","following_url":"https://api.github.com/users/donquixote/following{/other_user}","gists_url":"https://api.github.com/users/donquixote/gists{/gist_id}","starred_url":"https://api.github.com/users/donquixote/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/donquixote/subscriptions","organizations_url":"https://api.github.com/users/donquixote/orgs","repos_url":"https://api.github.com/users/donquixote/repos","events_url":"https://api.github.com/users/donquixote/events{/privacy}","received_events_url":"https://api.github.com/users/donquixote/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-12-05T18:19:21Z","updated_at":"2015-12-05T18:19:21Z","closed_at":null,"body":"Imagine I wanted to extend this library, and provide an alternative implementation for ReflectionParameter.\r\nTo do this, I would also have to replace ReflectionFunctionLikeTrait, to replace the \"new ReflectionParameter\" with something that creates my own type of reflection parameter.\r\nTo do this, I would also have to replace or extend ReflectionFunction and ReflectionMethod, so they can use the modified trait.\r\nAnd then I would have to replace ReflectionClass, to replace the \"new ReflectionMethod\" statements..\r\netc.\r\n\r\nThis could be solved by injecting a factory into each object. Then I would only have to extend ReflectionParameter, and extend the factory class, and replace the method that creates new parameter objects."}}