|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2015-01-12 22:11 UTC] danack@php.net
-Status: Open
+Status: Feedback
[2015-01-12 22:11 UTC] danack@php.net
[2015-01-25 04:22 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 13:00:02 2025 UTC |
Description: ------------ Since Traits can't be instantiated, it is impossible to get its methods. Test script: --------------- trait foo { protected $bar; public function set_bar ($bar) { $this->bar = $bar; } } $reflection = new ReflectionClass ("foo"); print_r ($reflection->getMethods ()[0]->getClosure ()); Expected result: ---------------- Closure Object ( [this] => EMPTY (WILD GUESS) [parameter] => Array ( [$bar] => <required> ) ) Actual result: -------------- PHP Warning: ReflectionMethod::getClosure() expects exactly 1 parameter, 0 given