Req #71037 [NEW]: Interfaces for Reflection API
| From: | andreas at dqxtech dot net | Date: | Sat, 05 Dec 2015 08:58:57 +0000 |
| Subject: | Req #71037 [NEW]: Interfaces for Reflection API | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-197613@lists.php.net to get a copy of this message | ||
From: andreas at dqxtech dot net
Operating system: Linux
PHP version: 7.0.0
Package: Reflection related
Bug Type: Feature/Change Request
Bug description:Interfaces for Reflection API
Description:
------------
The native Reflection API should provide interfaces like
\IReflectionClass, which can then be used for type hinting.
This way, libraries such as https://github.com/Roave/BetterReflection or
https://github.com/Andrewsville/PHP-Token-Reflection
don't need to
extend or wrap core reflection classes, but can instead implement the
interface.
One problem with this is that some libraries might only want to
implement some of the methods of e.g. \ReflectionFunction, but not all
of them. To allow this, there would need to be partial interfaces -
which could be a longer discussion.
I think for a start it would be sufficient to just have one interface
for each of the already existing classes of the Reflection API. More
interfaces could be added in the future.
Test script:
---------------
class C {..}
function foo(\IReflectionClass $reflectionClass) {..}
foo(new \ReflectionClass('C'));
class MyReflectionClass implements \IReflectionClass {
..
}
foo(new MyReflectionClass('C'));
--
Edit bug report at https://bugs.php.net/bug.php?id=71037&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71037&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71037&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71037&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=71037&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=71037&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=71037&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=71037&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=71037&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=71037&r=support
Expected behavior: https://bugs.php.net/fix.php?id=71037&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=71037&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=71037&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=71037&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71037&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=71037&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=71037&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=71037&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=71037&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=71037&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=71037&r=mysqlcfg