note 110928 added to reflectionparameter.getclass
| From: | Anonymous | Date: | Mon, 24 Dec 2012 18:21:03 +0000 |
| Subject: | note 110928 added to reflectionparameter.getclass | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-192666@lists.php.net to get a copy of this message | ||
"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;
}
?>
----
Server IP: 69.147.83.199
Probable Submitter: 213.74.31.207
----
Manual Page -- http://php.net/manual/en/reflectionparameter.getclass.php
Edit -- https://master.php.net/note/edit/110928
Del: integrated -- https://master.php.net/note/delete/110928/integrated
Del: useless -- https://master.php.net/note/delete/110928/useless
Del: bad code -- https://master.php.net/note/delete/110928/bad+code
Del: spam -- https://master.php.net/note/delete/110928/spam
Del: non-english -- https://master.php.net/note/delete/110928/non-english
Del: in docs -- https://master.php.net/note/delete/110928/in+docs
Del: other reasons-- https://master.php.net/note/delete/110928
Reject -- https://master.php.net/note/reject/110928
Search -- https://master.php.net/manage/user-notes.php