Repository navigation
[9.x] Register cutInternals casters for particularly noisy objects - #44514
Merged
Merged
Conversation
inxilpro
marked this pull request as ready for review
October 7, 2022 20:52
cutInternals casters for particularly noisy objectscutInternals casters for particularly noisy objects
Member
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This is a much smaller version of #44408 that addresses the major pain point of using
dd()in Laravel—dumping an object that holds a reference to the container (or another potentially large object that you don't actually care about from a debugging context).By default, Symfony registers the
StubCaster::cutInternalscaster for many internal classes, including the Symfony container and event dispatcher. This caster cuts down the object when dumping, but only if it's nested. This PR registers that same caster for a couple of Laravel interfaces that tend to be very large.For example, currently if you were to call
dd()on an instance of theRouter, your output will include include about 500 lines showing theDispatcherand another 500 lines showing theContainerbefore you get anywhere near the$routesor other values that you're likely trying to view.After this PR, those 1000 lines are collapsed to:
The
cutInternalscaster only applies if the object is nested, though. So if you calldd()directly on the container or event dispatcher, the entire object will be dumped.This feels like 70% of the benefits of Laravel Dumper for about 1% of the maintenance cost.