Req #64514 [Opn->Fbk]: Traits - ask for get_trait_methods
| From: | laruence@php.net | Date: | Tue, 26 Mar 2013 03:59:55 +0000 |
| Subject: | Req #64514 [Opn->Fbk]: Traits - ask for get_trait_methods | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-178094@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=64514&edit=1
ID: 64514
Updated by: laruence@php.net
Reported by: namarpi at yahoo dot com
Summary: Traits - ask for get_trait_methods
-Status: Open
+Status: Feedback
Type: Feature/Change Request
Package: Class/Object related
Operating System: Irrelevant
PHP Version: 5.4.13
Block user comment: N
Private report: N
New Comment:
could you please show us a real usage for this?
Previous Comments:
------------------------------------------------------------------------
[2013-03-25 17:27:46] namarpi at yahoo dot com
Description:
------------
---
From manual page: http://www.php.net/language.oop5.traits
---
I would like to ask for a method which should be called get_trait_methods, and acts like the
get_class_methods.
Test script:
---------------
// file1.php
trait My_Trait {
function trait_method_1() {}
function trait_method_2() {}
}
// file2.php
class My_Class {
use My_Trait;
function class_method_1() {
$trait_methods = get_class_methods( 'My_Trait' ); // <-- get_trait_methods
print_r( $trait_methods );
}
function class_method_2() {}
}
$my_object = new My_Class();
$my_object->class_method_1();
Expected result:
----------------
Array
(
[0] => trait_method_1
[1] => trait_method_2
)
Actual result:
--------------
Recently get_class_methods does this job.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=64514&edit=1