rfc:reflectionparameter-getclassname

Differences

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

Link to this comparison view

rfc:reflectionparameter-getclassname [2015/01/31 04:11]
philstu
rfc:reflectionparameter-getclassname [2017/09/22 13:28]
Line 1: Line 1:
-====== PHP RFC: ReflectionParameter::getClassName() ====== 
-  * Version: 0.1 
-  * Date: 2015-01-30 
-  * Author: Phil Sturgeon, me@philsturgeon.uk 
-  * Status: Under Discussion 
-  * First Published at: http://wiki.php.net/rfc/reflectionparameter-getclassname 
- 
-===== Introduction ===== 
- 
-Adds a new method to ReflectionParameter to allow easy access to a class name in a type hint, avoiding the need to actually load the class and use `get_class()` or `::class`. 
- 
-===== Proposal ===== 
- 
-This method lets you access the class name of a type hint as a string: 
- 
-<PHP> 
-<?php 
-class Foo { 
-  public function bar(Qux $qux) {} 
-} 
- 
-$class = new ReflectionClass(Foo::class); 
-$method = $class->getMethod("bar"); 
-$params = $method->getParameters(); 
- 
-var_dump($params[0]->getClassName()); // string(3) "Qux" 
-</PHP> 
- 
-===== Backward Incompatible Changes ===== 
- 
-None, unless somebody has made their own reflection extension and already have a getClassName() method. 
- 
-===== Proposed PHP Version(s) ===== 
- 
-PHP 7 
- 
-===== Open Issues ===== 
- 
-None so far 
- 
-===== Patches and Tests ===== 
- 
-https://github.com/php/php-src/pull/1039 
  
rfc/reflectionparameter-getclassname.txt · Last modified: 2017/09/22 13:28 (external edit)