Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Console] Add dumper#28898
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
[Console] Add dumper#28898
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
nicolas-grekas left a comment
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.
(a test case would be nice)
Uh oh!
There was an error while loading.Please reload this page.
ro0NL commentedOct 20, 2018
for tests i like to embed/wait for#28931, so the fallback would be tested using |
This PR was squashed before being merged into the 4.3-dev branch (closes#28931).Discussion----------[PhpUnitBridge] Added ClassExistsMock| Q | A| ------------- | ---| Branch? | master| Bug fix? | no| New feature? | yes| BC breaks? | no <!-- seehttps://symfony.com/bc -->| Deprecations? | no| Tests pass? | yes <!-- please add some, will be required by reviewers -->| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->| License | MIT| Doc PR |symfony/symfony-docs#10528I've thought about this before, and bumped into it again when trying to test#28898This PR allows to mock `class|interface|trait_exists` to enable specific code path testingCommits-------62caec1 [PhpUnitBridge] Added ClassExistsMock
fabpot commentedMar 4, 2019
lyrixx commentedMar 4, 2019
I already thought about something like that. IMHO the issue is somewhere else. This PR solves this this issue only in CLI, and only in the main entry point (the Command class). So here we go: Many other framework / language have a |
lyrixx commentedMar 4, 2019
BTW, for now you can aleady achieve this with |
ro0NL commentedMar 4, 2019
@lyrixx understood
Also there might be e.g. "debug-commands" with lots of code / output control. My main goal here was to obtain the dump value so i can put it in a console table, and have DX friendly output (#24208,#27684)
Im not sure using the logger is possible in my case, im looking mostly for So maybe get rid of |
ro0NL commentedMar 4, 2019 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
True, if we get rid of In that case putting it in VarDumper might be a better place 🤔 edit: no, if we move it to vardumper we dont need fallback support :D the whole idea was to NOT require var-dumper, but use it if available. |
lyrixx commentedMar 4, 2019
ro0NL commentedMar 8, 2019 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Cool :) tend to keep Unless we prefer |
fabpot commentedMar 22, 2019
I think I prefer composition, so |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
ro0NL commentedMar 22, 2019 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
i dont understand the failures yet, running a single test works as expected ( In this case var_dump( class_exists::class,class_exists(CliDumper::class),\Symfony\Component\Console\Helper\class_exists(CliDumper::class),class_exists(CliDumper::class));// Symfony\Component\Console\Helper\class_exists"// bool(true) <-- unexpected// bool(false)// bool(false) edit: i've split the tests for now into 2 individual suites, this seems to overcome the state issue. |
ro0NL commentedMar 22, 2019
Green&ready 👍 status: needs review |
Uh oh!
There was an error while loading.Please reload this page.
fabpot commentedMar 24, 2019
Thank you@ro0NL. |
This PR was squashed before being merged into the 4.3-dev branch (closes#28898).Discussion----------[Console] Add dumper| Q | A| ------------- | ---| Branch? | master| Bug fix? | no| New feature? | yes| BC breaks? | no <!-- seehttps://symfony.com/bc -->| Deprecations? | no| Tests pass? | yes <!-- please add some, will be required by reviewers -->| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->| License | MIT| Doc PR |symfony/symfony-docs#10502This PR adds a new `Dumper` helper in the Console component. As there are 2 types of dumps- debug purpose (e.g. `dd()`, `dump()`)- output purpose (see#24208,#27684)For the latter we cannot use the global system (debug) dumper, i.e. `VarDumper::dump()`, we need something tied to the current output and dependency free. Here it is:```php$io = new SymfonyStyle($input, $output);$dumper = new Dumper($io);$io->writeln($dumper([-0.5, 0, 1]));$io->writeln($dumper(new \stdClass()));$io->writeln($dumper(123));$io->writeln($dumper('foo'));$io->writeln($dumper(null));$io->writeln($dumper(true));```With VarDumper comonent:Without:>#27684 (comment) var-dumper is not a mandatory dep of fwb, can we do without?Now we can :)Commits-------fc7465c [Console] Add dumper
This PR was merged into the 4.3-dev branch.Discussion----------[Form][Console] Use dumper| Q | A| ------------- | ---| Branch? | master| Bug fix? | no| New feature? | yes| BC breaks? | no <!-- seehttps://symfony.com/bc -->| Deprecations? | no| Tests pass? | yes <!-- please add some, will be required by reviewers -->| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->| License | MIT| Doc PR | symfony/symfony-docs#... <!-- required for new features -->Continuation of#28898 for `debug:form`Commits-------a94228e [Form][Console] Use dumper
Uh oh!
There was an error while loading.Please reload this page.
This PR adds a new
Dumperhelper in the Console component. As there are 2 types of dumpsdd(),dump())For the latter we cannot use the global system (debug) dumper, i.e.
VarDumper::dump(), we need something tied to the current output and dependency free. Here it is:With VarDumper comonent:
Without:
Now we can :)