phpgt / phpgt/ServiceContainer
Should the ServiceContainer allow the app to overload default extension classes?
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
Specific example: My app deals with editing HTTP Requests, so I have a class called EditableRequest that extends Gt\Http\Request. Because of this, the EditableRequest class is instantiated and passed to the DefaultServiceLoader as the actual Request, rather than the actual request that's coming in.
This is obviously a flaw in the system, because it should be fine for the App's service loader to supply classes that extend already-existing classes.
The question is, what should the default behaviour be? If there's already a class defined in the default service loader, should we ignore loading any extras that simply extend the base classes? I think that would be safest.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the ServiceContainer and DefaultServiceLoader entry points involved in selecting the actual Request instance, using the EditableRequest example as the reproduction. Determine the intended precedence when an app-supplied class extends a default service class, then add coverage showing the chosen behavior and verify that the incoming request is resolved correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100