[13.x] Bind manager instances to custom driver closures #57173
+90
−14
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Laravel have many managers, some of them bind themselves to custom driver closures, some others don't.
This PR fixes this injustice. Also, tests have been added for all managers to enforce this behavior.
Related: #13436.
Why?
When writing custom driver, you might probably need to call protected manager methods during its registration.
For example, in case of FilesystemManager, it may be createFlysystem method.
Why not 12.x?
It is a breaking change. You will still have
app
at your disposal, becauseapp
exists in bothServiceProvider
and all managers.But you'll lose ability to directly call
ServiceProvider
methods.Upgrade steps
If you do call service provider methods inside
extend
callback, you'll need to move those calls outside and useuse ($...)
to access parent scope.Examples
Before
After
or just