modularity
modularity copied to clipboard
Fix status check in `PackageProxyContainer`
Please check if the PR fulfills these requirements
- [x] The commit message follows our guidelines
- [x] Tests for the changes have been added (for bug fixes/features)
- [x] Docs have been added/updated (for bug fixes/features)
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Bug fix.
What is the current behavior? (You can also link to an open issue here)
A connected package's services can not be accessed if the package is "built"
What is the new behavior (if this is a feature change)?
A connected package's services can be accessed if the package is "built".
Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)
No.
Other information:
The implementation of Package::connect()
predates the implementation of Package::built()
.
Before Package::built()
was introduced in 1.7.0 it was only safe to access a Package's container after having called Package::boot()
.
Now, we can do $package->build()->container()
without issues.
The implementation of PackageProxyContainer
was not updated when we introduced Package::built()
, so we can still not access services from connected packages if they are not booted.
This means using built()
early and boot()
later, which is the reason why we introduced built()
in the first place is "dangerous" because if someone connects a built package and tries to access its services they will get an exception.
I committed a test to master
that tests there the bug, and this test is merged back into this branch to prove this is now solved.