Reflection API: Add ::getFullName() method.
| From: | Andreas Hennings | Date: | Mon, 11 Dec 2017 03:00:06 +0000 |
| Subject: | Reflection API: Add ::getFullName() method. | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-101301@lists.php.net to get a copy of this message | ||
I propose a new method ::getFullName() for all methods that implement
\Reflector.
(I would add it to the \Reflector interface, but this would be a BC break.)
The full name would be, depending on the type:
function: "str_replace()", "Acme\foo()".
class: "Acme\Animal\Cat", "stdClass".
method: "Acme\Animal\Cat::meow()".
property: "Acme\Animal\Cat::$color".
etc.
I don't know if we can cover all reflection API classes in a meaningful way.
E.g. for ReflectionObject, the full name would be the same as for the
class, otherwise it would get complicated.
Currently the ::__toString() and ::export() return something else,
which is not really useful.
The goal is to have something that is different for different items.
E.g. a class and a function with the same name need to have a
different "full name", hence the added "()" for functions and methods.
As a rule of thumb, the "full name" is what one would put after a @see
tag in phpDoc, but without the leading "\\".
For consistency with the rest of PHP and reflection API, we should use
QN and not FQN as return value.
Related: I started another thread proposing a ::getHash() method.
I originally though to propose the two things in the same thread, but
I now think they should be discussed independently.