Doc #78785 [Fbk->Opn]: ReflectionType::getName() is undocumented
| From: | eric at ericstern dot com | Date: | Wed, 06 Nov 2019 00:45:25 +0000 |
| Subject: | Doc #78785 [Fbk->Opn]: ReflectionType::getName() is undocumented | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-17047@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=78785&edit=1
ID: 78785
User updated by: eric at ericstern dot com
Reported by: eric at ericstern dot com
Summary: ReflectionType::getName() is undocumented
-Status: Feedback
+Status: Open
Type: Documentation Problem
Package: Reflection related
Operating System: n/a
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
Actually, that does seem like the case. I followed the docs from
ReflectionFunctionAbstract->getReturnType() and wasn't aware that the subclass existed. When
actually running the code, I simply guessed at a couple of names that might work based on the other
Reflection APIs, and getName() happened to work.
If that's the case, it would be beneficial to expand the docs around that area - as it stands
now, the examples are relying on the deprecated functionality
(https://www.php.net/manual/en/reflectionfunctionabstract.getreturntype.php), and it's not
clear when (or even if) the base ReflectionType would be returned and not ReflectionNamedType. At
best, this means having to add additional instanceof checks to code working with these APIs.
Previous Comments:
------------------------------------------------------------------------
[2019-11-05 23:42:48] requinix@php.net
I don't see anything to suggest ReflectionType::getName() exists.
Are you thinking of ReflectionNamedType::getName()?
https://www.php.net/manual/en/reflectionnamedtype.getname.php
------------------------------------------------------------------------
[2019-11-05 23:35:13] eric at ericstern dot com
Description:
------------
---
From manual page: https://php.net/class.reflectiontype
---
As of 7.1.0, ReflectionType::__toString() has been deprecated. There appears to be a getName()
method which functions as a replacement, but it is both completely undocumented and not even visible
by use of the reflection APIs.
The getName() method either should be documented (another bug suggests it was intentionally
removed), or a suitable equivalent should be exposed and documented. As it is, the ReflectionType
class is completely useless without having some way to access the type it represents.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=78785&edit=1