#49162 [Opn->Bgs]: Interfaces not Inherited in Method Signatures

From: Date: Wed, 05 Aug 2009 07:54:17 +0000
Subject: #49162 [Opn->Bgs]: Interfaces not Inherited in Method Signatures
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-140672@lists.php.net to get a copy of this message
ID: 49162 Updated by: jani@php.net Reported By: wjaspers4 at gmail dot com -Status: Open +Status: Bogus Bug Type: Class/Object related Operating System: Windows XP SP3 (32-bit) PHP Version: 5.2.10 New Comment: Please do not submit the same bug more than once. An existing bug report already describes this very problem. Even if you feel that your issue is somewhat different, the resolution is likely to be the same. Thank you for your interest in PHP. Previous Comments: ------------------------------------------------------------------------ [2009-08-05 02:41:06] wjaspers4 at gmail dot com Description: ------------ In proper OOP, i should be able to define an interface, and have a class or abstract class implement it. If I create a class (or abstract class) which calls upon the interface in a method signature, everything is ok. However; if I extend the aforementioned class (or extend unto an abstract class), and I call upon the class which implements the interface, my compilation fails. Even if I provide a method in my interface and implement it in the class which uses the interface, it still fails. I have been able to reproduce this in both php 5.2.10 and 5.2.6 (personal and work servers, respectively) Reproduce code: --------------- interface Validatable {}; class Form implements Validatable { } abstract class Validator { abstract public function Validate( Validatable $v ); } abstract class Form_Validator extends Validator { public function Validate( Form $f ) { // do something in here... } } Expected result: ---------------- I should see nothing. OR -- if i look in memory, I should see that my Form_Validator has a Validate method in it. Actual result: -------------- Fatal error: Declaration of Form_Validator::Validate() must be compatible with that of Validator::Validate() in .... ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=49162&edit=1

« previous php.bugs (#140672) next »