Proper dumper location when used together with Symfony VarDumper #603
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.
Symfony VarDumper (a dependency of many packages, so it is often installed even when you don't want it) often takes over the dump function when both are installed.
It also conditionally defines it, and unfortunately, it’s impossible to control which definition gets included first. Due to the same reason, it’s also not (in most cases) possible to define a custom function and let composer autoload it using
"autoload": {"files": [
. The only option is to require it manually before the Composer autoloader (which, in some tools like PHPUnit, is even required automatically first).At least Symfony allows registering a custom handler using
VarDumper::setHandler(...)
, so it’s possible to redirect it to Tracy’s dump, which I prefer 🙂. There is a minor issue, though: the location resolved from the stack trace points to VarDumper instead.If this got accepted, I can add the PR to docs too.