rfc:reflectionparameter.typehint
This is an old revision of the document!
PHP RFC: Add typehint accessors to ReflectionParameter
- Version: 1.0
- Date: 2014-05-29
- Author: Sara Golemon, pollita@php.net
- Status: Under Discussion
- First Published at: http://wiki.php.net/rfc/reflectionparameter.typehint
Proposal
Add ReflectionParameter::hasTypehint() and ReflectionParameter::getTypehintText() to make parsing function/method signatures and replicating them for mocking frameworks simpler.
Current mocking frameworks have to cast the ReflectionParameter to a string, then text parse that string to retrieve the information.
Proposed PHP Version(s)
5.next (5.7)
On the naming
While getTexthint() might seem the obvious choice, I wanted to leave that open for compatibility in case we ever decide to return a “ReflectionTypehint” type object. getTypehintText() indicates that we're specifically asking for the string version of the typehint.
Implementation and new unit test
rfc/reflectionparameter.typehint.1401393412.txt.gz · Last modified: 2017/09/22 13:28 (external edit)