Req #64514 [NEW]: Traits - ask for get_trait_methods
| From: | namarpi at yahoo dot com | Date: | Mon, 25 Mar 2013 17:27:46 +0000 |
| Subject: | Req #64514 [NEW]: Traits - ask for get_trait_methods | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-178081@lists.php.net to get a copy of this message | ||
From: namarpi at yahoo dot com
Operating system: Irrelevant
PHP version: 5.4.13
Package: Class/Object related
Bug Type: Feature/Change Request
Bug description:Traits - ask for get_trait_methods
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 bug report at https://bugs.php.net/bug.php?id=64514&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=64514&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=64514&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=64514&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=64514&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=64514&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=64514&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=64514&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=64514&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=64514&r=support
Expected behavior: https://bugs.php.net/fix.php?id=64514&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=64514&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=64514&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=64514&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64514&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=64514&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=64514&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=64514&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=64514&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=64514&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=64514&r=mysqlcfg