note 126475 added to reflectionclass.getmethod
| From: | sagittaracc at gmail dot com | Date: | Mon, 04 Oct 2021 14:47:07 +0000 |
| Subject: | note 126475 added to reflectionclass.getmethod | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-217027@lists.php.net to get a copy of this message | ||
if you ever need to get the body of a method, use this extension
(https://github.com/sagittaracc/reflection):
namespace sagittaracc\classes;
class Test
{
public function method()
{
if (true) {
return 'this method';
}
return 'never goes here';
}
}
$reflection = new ReflectionClass(Test::class);
$method = $reflection->getMethod('method');
echo $method->body; // if (true) { return 'this method'; } return 'never goes
here';
----
Server IP: 45.112.84.4
Probable Submitter: 45.112.85.242 (proxied: 82.138.61.202)
----
Manual Page -- https://php.net/manual/en/reflectionclass.getmethod.php
Edit -- https://main.php.net/note/edit/126475
Del: integrated -- https://main.php.net/note/delete/126475/integrated
Del: useless -- https://main.php.net/note/delete/126475/useless
Del: bad code -- https://main.php.net/note/delete/126475/bad+code
Del: spam -- https://main.php.net/note/delete/126475/spam
Del: non-english -- https://main.php.net/note/delete/126475/non-english
Del: in docs -- https://main.php.net/note/delete/126475/in+docs
Del: other reasons-- https://main.php.net/note/delete/126475
Reject -- https://main.php.net/note/reject/126475
Search -- https://main.php.net/manage/user-notes.php