-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[VarDumper] Add Dump object to configure dumping options #17290
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
return 'cli' === PHP_SAPI ? 'cli' : 'html'; | ||
} | ||
|
||
protected function getDumper($format, $output) |
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.
does it need to be protected ?
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.
to make the class SOLID, especially the "O": it opens to specializations by "di-via-getter-specialization"
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.
well, this object is a kind-of value object. Using inheritance as an extension point looks weird to me (and inheritance is the most painful way to open for extension as far as BC is concerned)
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.
To me, this object is way more a builder than a value object; builders are specialized, and looking at the feedback I see here and here, this one will be specialized... Thus, I'd want it to be possible from the beginning, by inheritance or something better if possible.
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.
Why not to inject Dumper
into constructor then? You still can initialize default dumper with static factory method if you really want it.
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.
the returned dumper depends on two parameters, we can't inject only one. We could inject a factory thought, but that looks overkill to me for now...
How would this integrate with the profiler ? |
'withRefHandles' => array(true), | ||
'withCasters' => array(array(), false), | ||
'withFilter' => array(0), | ||
); |
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.
why an array like this rather than a bunch of properties ?
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.
because I use __call
(same answer for your other comments)
I don't know yet |
This should be figured out. If it cannot send dumps to the profiler, it is not the right API IMO |
d7ff41e
to
fc5fc3e
Compare
/** | ||
* @author Nicolas Grekas <[email protected]> | ||
*/ | ||
class Dump2 |
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.
@stof I added this Dump2 implementation so that we can compare with and without __call
, wdyt?
ad1acaa
to
61dd58a
Compare
… Doctrine Cache (nicolas-grekas) This PR was merged into the 3.1-dev branch. Discussion ---------- [Cache] Add DoctrineProvider, for using PSR-6 pools in Doctrine Cache | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - This would allow cache pool configuration as usual (see #17290) before injecting the resulting doctrine cache provider anywhere such an interface is required. Commits ------- 5d256dd [Cache] Add DoctrineProvider, for using PSR-6 pools in Doctrine Cache
61dd58a
to
2f50694
Compare
2f50694
to
3bae568
Compare
@nicolas-grekas Are we far away from something that works? |
I'm not close to finishing but I make slow progress :) |
Closing until it's ready again |
The goal of this PR is to allow devs to configure all dumping options.
The targeted usage would be something like
dump($foo)->to('php://stderr')->as('text')->withMaxDepth(3)->die();
Steps:
withTitle()
usefulness, implementwithTrace()
and enable it by default when no var is provideddump()
/VarDumper::dump