-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
VarDumper and DebugBundle #10640
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VarDumper and DebugBundle #10640
Conversation
Awesome bulk of work was done! Very interesting component. I hope it will be part of Symfony. |
{ | ||
foreach ($c as $k => $obj) { | ||
$a[$k] = $obj; | ||
if (null !== $i = $c->getInfo()) $a["\0~\0$k"] = $i; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code style : it should be on two lines, using brackets
a21985f
to
75500e2
Compare
Here is the new default rendering: I removed the option for several rendering engines and choose to keep the "base" one. This removes the Patchwork and @OwlyCode renderer. As the JsonDumper is not used anymore, I also removed it and its related tests+doc from the git history of this PR. I kept them in patchwork/dumper so they can come back again later. I also enhanced the base rendering engine with some JS. This should match some of your suggestions @webmozart . (the remaining fabbot error is intentional) |
75500e2
to
80fd736
Compare
It took time, but here we go, this is in now. Thank you very much @nicolas-grekas. |
…an, moux2003, tony-co, romainneutron, oscherler, lyrixx) This PR was merged into the 2.6-dev branch. Discussion ---------- VarDumper and DebugBundle | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | none | License | MIT | Doc PR | none From a user land point of view, this PR creates a global `dump()` function that is to be used instead of `var_dump()`. The component can be used standalone in any dev workflow. Please see the [provided README](https://github.com/symfony/symfony/pull/10640/files?short_path=52d526f#diff-52d526f19bc9e3825c80e7694755409c) for details. When used with the Framework bundle, variables passed to `dump()` are dumped in a new dedicated panel in the web toolbar. The function is also available in twig templates. Regarding the implementation, I'm pretty sure you'll find a lot to comment. As I'm sure of nothing else, not even the names of things, please do. I tried to organize this PR in several commits, from the most fundamental algorithm to pure Symfony glue. I suggest you follow this order while progressing in the review and the discussion around this PR, so that we can together validate commits one after the other. Don't hesitate to fork the PR and submit PR on it, I'll cherry-pick your patches. TODO: - [x] open a doc PR: symfony/symfony-docs#4243 - [x] open a PR on the Standard edition: symfony/symfony-standard#710 - [x] prefix the CSS classes - [x] tests for the DebugBundle + other Symfony glue classes - [x] inline css and js for compat with e.g. Silex - [x] finish and merge nicolas-grekas/Patchwork-Dumper#5 for better UX - [x] show a dump excerpt on hovering the icon in the toolbar - [x] verify README and comments - [x] validate interfaces/names (Caster / Cloner / Dumper) - [x] validate new VarDumper component + DebugBundle - [x] validate Resource/ext/ vs independent repos. - [x] test and define behavior after KernelEvents::RESPONSE - [x] update dependencies between components/bundles and composer.json files - [x] no hard dep on iconv Not for this PR but might be worth later: - show a light stack trace + timing + memory at debug() calls - create a "theme" concept for custom colors/UX Commits ------- 80fd736 [DebugBundle] Enhance some comments 2e167ba [TwigBridge] add Twig dump() function + tests and fixes 0f8d30f [VarDumper] Replace \e with \x1B in CliDumper to support colour in PHP < 5.4 d43ae82 [VarDumper] Add workaround to https://bugs.php.net/65967 a8d81e4 [DebugBundle] Inlined assets to avoid installation issues 5f59811 [DebugBundle] Add doc example for Twig usage e4e00ef [TwigBridge] DumpNode and Token parser de05cd9 [DebugBundle] enhance dump excerpts 49f13c6 [HttpKernel] add tests for DumpDataCollector 081363c [HttpKernel] tests for DumpListener 0d8a942 [VarDumper] add Stub objects for cutting cleanly and dumping consts c8746a4 [DebugBundle] add tests for twig and for the bundle 8d5d970 [DebugBundle] adjust after review eb98c81 [DebugBundle] dump() + better Symfony glue 9dea601 [DebugBundle] global dump() function for daily use 297d373 [VarDumper] README, LICENSE and composer.json a69e962 [VarDumper] tests for HtmlDumper 5eaa187 [VarDumper] tests for CliDumper e6dde33 [VarDumper] HTML variant of the CLI dumper fa81544 [VarDumper] CLI dedicated dumper and related abstract 1d5e3f4 [VarDumper] interface for dumping collected variables 0266072 [VarDumper] casters for DOM objects c426d8b [VarDumper] casters for Doctrine objects 0a92c08 [VarDumper] casters for PDO related objects da3e50a [VarDumper] casters for SPL data structures c91bc83 [VarDumper] casters for exceptions representation 3ddbf4b [VarDumper] add casters for per class/resource custom state extraction 5b7ae28 [VarDumper] symfony_debug ext. fast and memory efficient cloning algo 07135a0 [VarDumper] algo to clone any PHP variable to a breadth-first queue 4bf9300 [Debug] a README for the debug extension eec5c92 [Debug] Symfony debug extension
👏 |
This is an amazing enhancement, thanks to all contributors ! |
awesome! 👊 |
Was waiting impatiently for this feature, thanks guys ! EDIT : Though, bad news for LadybugBundle, won't be very useful anymore... |
This PR was merged into the 2.6-dev branch. Discussion ---------- Enable DebugBundle This enables the DebugBundle as proposed in symfony/symfony#10640 Commits ------- dadea61 Enable DebugBundle
For reference, if you'd like to use VarDumper / dump() in your Symfony 2.3/4/5 app, I backported the Debug-Bundle, here it is: |
@nicolas-grekas Could it be worth to add this information to the documentation? |
From a user land point of view, this PR creates a global
dump()
function that is to be used instead ofvar_dump()
. The component can be used standalone in any dev workflow. Please see the provided README for details.When used with the Framework bundle, variables passed to
dump()
are dumped in a new dedicated panel in the web toolbar. The function is also available in twig templates.Regarding the implementation, I'm pretty sure you'll find a lot to comment. As I'm sure of nothing else, not even the names of things, please do.
I tried to organize this PR in several commits, from the most fundamental algorithm to pure Symfony glue.
I suggest you follow this order while progressing in the review and the discussion around this PR, so that we can together validate commits one after the other.
Don't hesitate to fork the PR and submit PR on it, I'll cherry-pick your patches.
TODO:
Not for this PR but might be worth later: