[php-src] Issue #8488: Add a way to retrieve a reflection object for the target of ReflectionAttribute

From: Date: Tue, 03 May 2022 13:21:50 +0000
Subject: [php-src] Issue #8488: Add a way to retrieve a reflection object for the target of ReflectionAttribute
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-241405@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/8488 Author: ollieread ### Description The only way, currently, to retrieve the specific target for a ReflectionAttribute instance is to maintain a reference to it within userland, and map it accordingly. Although there's no way currently, to create an instance of ReflectionAttribute from outside of one of the getAttributes methods, if you're doing anything that collects multiple attributes from multiple sources, it's currently impossible to backwards engineer their source/target, without a prior map. I've done a bit of digging, and I believe that if we can pass the current reflection_object to reflection_attribute_factory, and have it stored in attribute_reference, we could add a ReflectionAttribute::getTargetReflection() with a return type of either Reflector or a union type. I can't be certain of the potential performance issues with this, but I'm somewhat confident it would be negligible.

« previous php.bugs (#241405) next »