[VarDumper] Support for ReflectionAttribute#38167
Conversation
1e313ff to
6ac8ec3
Compare
| /** | ||
| * @param \Reflector|\ReflectionAttribute $c | ||
| */ | ||
| private static function addMap(array &$a, $c, $map, $prefix = Caster::PREFIX_VIRTUAL) |
There was a problem hiding this comment.
💡 It felt a bit odd that I needed to do this, so I've opened https://bugs.php.net/bug.php?id=80097 for clarification.
6ac8ec3 to
6225dc2
Compare
|
The segfault that be observed in https://travis-ci.org/github/symfony/symfony/jobs/726646852 (line 3655) appeared after my changes to the But when I rerun that command a couple of times, it eventually works and the tests pass. I haven't been able to isolate the problem yet, but maybe this is an interesting find for @nikic or @beberlei that helps with stabilizing the reflection API for attributes. |
|
Do you have the stacktrace for the segfault? |
There was a problem hiding this comment.
Thanks for the PR.
This should target master to me, as I have this rule in mind:
- making existing code run on newest PHP versions should be considered as a bug fix
- making Symfony compatible with new features of the language should be considered as a new feature.
|
I use the |
6225dc2 to
b61e5c4
Compare
b61e5c4 to
f2d674c
Compare
|
for |
f2d674c to
34dbf01
Compare
|
Thank you @derrabus. |

VarDumper currently does not understand that certain reflection objects might have attributes attached to it. Dumping a
ReflectionAttributejust yieldsReflectionAttribute {#4711}which is not really helpful. This PR attempts to fix this.While working on this, I noticed that class constants (which can be reflected on since PHP 7.1) are just dumped as plain values, so I've also added a caster for
ReflectionClasConstantas bonus.The full output for the
LotsOfAttributesfixture class that is included with is PR looks like this:Details