ID:               34807
 Updated by:       [EMAIL PROTECTED]
 Reported By:      daarius at hotmail dot com
-Status:           Open
+Status:           Feedback
 Bug Type:         Class/Object related
 Operating System: WinXP
 PHP Version:      5.0.5
 New Comment:

Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip




Previous Comments:
------------------------------------------------------------------------

[2005-10-10 12:27:02] daarius at hotmail dot com

Description:
------------
The interface of a parent class is also forced to be implemented on to
the children classes if they use methods with same name as in
Interface. Even though the parent class has implemented the methods
declared in the Interface legally.

Reproduce code:
---------------
interface MyInterface {
   public function Z($s);
}

class MyClass implements MyInterface {
   public function Z($s) {}
}

class MySubClass extends MyClass {
   public function Z() {}
}


Expected result:
----------------
Above should be legal (at least i think), because parent is
implementing the interface, the child is just extending the parent's
method.

But, if we remove the method completely from child class, then there is
no error message and Interface is no longer being forced on to child.
This suggests inconsistency.

Also, if we remove the interface from the code, then the parent child
extension of the same method name is still legal, as the number of
arguments is not being checked anymore.

Actual result:
--------------
Fatal error: Declaration of MySubClass::Z() must be compatible with
that of MyInterface::Z() in C:\httpd\PHPObject3.0\index.php on line 12


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=34807&edit=1

Reply via email to