note 110928 deleted from reflectionparameter.getclass by danbrown
| From: | danbrown@php.net | Date: | Thu, 17 Jan 2013 15:30:34 +0000 |
| Subject: | note 110928 deleted from reflectionparameter.getclass by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-193153@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
"tom at r dot je" 's logic does not work for namespaced classes. Though with a simple
addition you can just make it possible:
<?php
function getClassName(ReflectionParameter $param) {
preg_match('/\[\s\<\w+?>\s([\w\\\\]+)/s', $param->__toString(), $matches);
return isset($matches[1]) ? $matches[1] : null;
}
?>