-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[VarDumper] Output the location of calls to dump() #31446
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
Conversation
5ff617f
to
c7cc20a
Compare
The implementation relies on a statefull service. This should be avoided. |
@nicolas-grekas Thank you for the feed back. I've changed the implementation. Do you have an idea on how can i insulate this new feature and set her only for CliDumper? Because currently, without forcing file and line to |
@ktherage can we move forward on this ;) ? |
@Simperfit I'm stuck on unit tests. I this they are to much nested each other. Testing cli dumper makes HtmlDumper, ServerDumper and all the caster crashed. |
57c55fd
to
a5f8258
Compare
@Simperfit @nicolas-grekas, I did some work on that, tests are finally green. |
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.
I'm sorry but I'm not comfortable at all with the way this is implemented. This feels like breaking all semantics to fit the target.
- Data::dump() is about the represented structure. It cannot snif the context.
- CliDumper is about dumping the same structure, not the context.
I think ServerDumper does it properly:
- the context is collected completly separately, in a flexible way
- the context is dumped separately
Here is a proposal: add a ContextualizedDumper that collects+dumps contexts and dumps using a decorated dumper - very alike ServerDumper. Writting to the output should be done using the decorated dumper too (unlike ServerDumpCommand, which write to Console i/o)
I hope this helps.
src/Symfony/Component/VarDumper/Dumper/ContextProvider/CliContextProvider.php
Outdated
Show resolved
Hide resolved
@nicolas-grekas I've applied your recommendations (hoping i've not misread them). |
c705ebc
to
dace4a0
Compare
I push-forced on your fork to rebase+target 4.4, and do some changes. |
@nicolas-grekas i've adapter unit test according to your changes and i've added one test for console command. Can you check them and tell me if they are good for you? |
5e8f3f0
to
863727e
Compare
@ktherage the reason is that we wire a service as a dumper. Look for cli_dumper/html_dumper I think in the code base |
@nicolas-grekas Yes, here it is. <service id="var_dumper.contextualized_cli_dumper" class="Symfony\Component\VarDumper\Dumper\ContextualizedDumper">
<argument type="service" id="var_dumper.cli_dumper" />
<argument type="collection">
<argument type="service" key="source">
<service class="Symfony\Component\VarDumper\Dumper\ContextProvider\SourceContextProvider">
<argument>%kernel.charset%</argument>
<argument type="string">%kernel.project_dir%</argument>
<argument type="service" id="debug.file_link_formatter" on-invalid="null" />
</service>
</argument>
</argument>
</service> and use this new service in the debug bundle in place of the |
0914988
to
282eb4b
Compare
@nicolas-grekas I've worked on that and fixed the error for commands (see bellow). I also tried to fix the tests. But for me the CI behave strangely (depending on the php version). |
2f38a46
to
44fa66c
Compare
aec00cb
to
d05003d
Compare
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.
(I tested locally and fixed tests)
d05003d
to
f0a59d3
Compare
Thank you @ktherage. |
…herage) This PR was merged into the 4.4 branch. Discussion ---------- [VarDumper] Output the location of calls to dump() | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | not tested yet | Fixed tickets | #30830 | License | MIT | Doc PR | see #30830 Commits ------- f0a59d3 [VarDumper] Output the location of calls to dump()
see #30830