#43167 [Opn->Ver]: ReflectionMethod::isConstructor() does not work for interfaces
| From: | helly@php.net | Date: | Tue, 06 Nov 2007 13:25:23 +0000 |
| Subject: | #43167 [Opn->Ver]: ReflectionMethod::isConstructor() does not work for interfaces | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-119328@lists.php.net to get a copy of this message | ||
ID: 43167
Updated by: helly@php.net
Reported By: sebastian@php.net
-Status: Open
+Status: Verified
Bug Type: Scripting Engine problem
-Operating System: Irrelevant
+Operating System: *
-PHP Version: 5.3CVS-2007-11-01 (CVS)
+PHP Version: 5.2.*
New Comment:
This is discussable as it is not really a constructor here. It simply
forces the protocol for the constructor. We do mark abstract
constructors as ctors though, so we imho should do so in interfaces as
well.
[marcus@zaphod PHP_5_3]$ php -r 'abstract class t{abstract function
__construct();} ReflectionClass::export("T");'
make: `sapi/cli/php' is up to date.
Class [ <user> abstract class t ] {
@@ Command line code 1-1
- Constants [0] {
}
- Static properties [0] {
}
- Static methods [0] {
}
- Properties [0] {
}
- Methods [1] {
Method [ <user, ctor> abstract public method __construct ] {
@@ Command line code 1 - 1
}
}
}
Previous Comments:
------------------------------------------------------------------------
[2007-11-01 07:52:22] sebastian@php.net
Description:
------------
ReflectionMethod::isConstructor() does not work for methods that are
named __construct() in interfaces.
Reproduce code:
---------------
<?php
interface Foo
{
public function __construct(Bar $bar);
}
$interface = new ReflectionClass('Foo');
$constructor = $interface->getMethod('__construct');
var_dump($constructor->isConstructor());
Expected result:
----------------
bool(true)
Actual result:
--------------
bool(false)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=43167&edit=1