Make `MissingRequiredArgumentException` more friendly
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 94
- Forks
- 17
- Avg merge
- 56m
- Merged PRs (30d)
- 1
Description
It would be nice to improve the MissingRequiredArgumentException - add a flag whether the Container is passed to the Injector.
And if the Container is not passed, and the argument being resolved is a class, then output a friendly message (FriendlyException) will be like "pass an object of the required type as an argument to invoke()/make() or pass a Container when creating the Injector"
If the Container parameter was set, then the friendly message will be like "add an object of the required type to the argument list or make sure that the configured Container can resolve it"
Originally posted by @roxblnfk in https://github.com/yiisoft/injector/issues/86#issuecomment-1864146016
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 locating MissingRequiredArgumentException and the Injector paths for invoke() and make(), then inspect how Container presence is currently available during resolution. Implement the two requested messages based on whether a Container was passed, and verify that missing class arguments produce the appropriate FriendlyException wording.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100