-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[VarDumper] Add support for virtual properties #57833
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] Add support for virtual properties #57833
Conversation
015ee30
to
399306b
Compare
src/Symfony/Component/VarDumper/Caster/VirtualHookedPropertyStub.php
Outdated
Show resolved
Hide resolved
cc24170
to
92dadd7
Compare
5f83426
to
1820d2b
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.
If we want to be more consistent, virtual properties should be displayed using visual hints, not explicit wordings.
I suggest using italic for virtual property names.
Then, for the value, I agree not calling the hook. I'd just make this closer to how UndefinedStub works (same without the ?
prefix, and with some placeholder for the no-type case)
I'd also name the stub VirtualStub (same naming convention as UninitializedStub.
WDYT?
1820d2b
to
c909cf9
Compare
686eb84
to
4f744cc
Compare
4f744cc
to
f73c776
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 fixed the implementation.
Can you please have a look at tests, and add some for html?
f73c776
to
68c9ae6
Compare
I pushed a revision containing the following changes (see https://github.com/symfony/symfony/compare/f73c776c1ad8add7b96f1ca557e7b2ff5d43b144..68c9ae6d3c1bd6f03fa185e144ae6e5f31fedafe):
Thank you for helping me fix the implementation! |
src/Symfony/Component/VarDumper/Tests/Fixtures/VirtualProperty.php
Outdated
Show resolved
Hide resolved
50e1537
to
b185923
Compare
317f8a4
to
5169f22
Compare
5169f22
to
a978c75
Compare
Thank you @alexandre-daubois. |
This brings support for hooked virtual properties. Given the following code:
The following is dumped:
Currently, it dumps the property as an uninitialized one, as
+fullName: ? string
. I think it would be nice to know that more than being uninitialized, it's actually a virtual property.Given that hooks contain arbitrary code, I'm not sure it would be a good idea to try to display the resulting value in the dump of the virtual property.