rfc:reflectionparameter.typehint

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
rfc:reflectionparameter.typehint [2014/05/30 16:34] – Improved Introduction. levimrfc:reflectionparameter.typehint [2014/05/30 16:40] levim
Line 5: Line 5:
   * Status: Under Discussion   * Status: Under Discussion
   * First Published at: http://wiki.php.net/rfc/reflectionparameter.typehint   * First Published at: http://wiki.php.net/rfc/reflectionparameter.typehint
 +
 +===== Introduction =====
 +
 +This RFC proposes some improvements to the way we handle type information in reflection. This work will make it easier for writing tools that render type information from reflection. If the [[returntypehinting|Return Type RFC]] is accepted this RFC also unifies the reflection API for type information for both parameters and return types.
  
 ===== Proposal ===== ===== Proposal =====
  
-This RFC proposes a new class ''ReflectionTypeAnnotation'' to represent type information; currently this information is contained on the ''ReflectionParameter'' class. This RFC adds methods to ''ReflectionParameter'' to use this new class: <php>ReflectionParameter::hasTypeAnnotation()</php> and <php>ReflectionParameter::getTypeAnnotation()</php>. If the Return Type RFC is accepted it will then it will also use this new ''ReflectionTypeAnnotation'' class.+This RFC proposes a new class ''ReflectionTypeAnnotation'' to represent type information. This RFC adds methods to ''ReflectionParameter'' to use this new class: <php>ReflectionParameter::hasTypeAnnotation()</php> and <php>ReflectionParameter::getTypeAnnotation()</php>. If the Return Type RFC is accepted it will then it will also use this new ''ReflectionTypeAnnotation'' class.
  
 The class ''ReflectionTypeAnnotation'' also has ''%%__toString%%'' method 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. The class ''ReflectionTypeAnnotation'' also has ''%%__toString%%'' method 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.
rfc/reflectionparameter.typehint.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1