ID: 29417 Updated by: [EMAIL PROTECTED] Reported By: ah08010-zend at yahoo dot com -Status: Open +Status: Suspended Bug Type: Feature/Change Request -Operating System: Windows 2000 +Operating System: * PHP Version: 5.0.0 -Assigned To: +Assigned To: hellz New Comment:
Wow it seems you'd be the first person answering my OOP test question correctly. Anyway structer is the wrong word here but you are right. The code you have here should work. If you wanna experiment with that you can try this patch: http://marcus-boerger.de/php/ext/ze2/ze2-type-hint-classes-20040719.diff.txt But though it works in CLI this is not even a proof of concept. Previous Comments: ------------------------------------------------------------------------ [2004-07-28 03:41:39] ah08010-zend at yahoo dot com Description: ------------ Type hints in a derived class that specify a function parameter implements an interface derived from the interface specified in the (other) interface implemented by the base class (whew!) are flagged as an error despite being type-compatible: Fatal error: Declaration of TranslatedPlural::compose() must be compatible with that of Translatable::compose() in ...\TranslatedMessage.php on line 83 Reproduce code: --------------- // Parameter type hint (BASE) interface TranslationMap { public function fetch($the_key); } // Parameter type hint (DERIVED) interface TranslationLexicon extends TranslationMap { public function plural($the_noun, $the_count); } // Implementation Interface interface Translatable { function set_args(); function compose(TranslationMap $map); } // Base class class TranslatedMessage implements Translatable { public function set_args() { } public function compose(TranslationMap $lex) { } } // Derived class class TranslatedPlural extends TranslatedMessage { public function compose(TranslationLexicon $lex) { } } Expected result: ---------------- I expect that the derived class, TranslatedPlural, will be checked for a stricter (but type-compatible) interface than the base class. Actual result: -------------- Fatal error: Declaration of TranslatedPlural::compose() must be compatible with that of Translatable::compose() in ...\TranslatedMessage.php on line 83 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=29417&edit=1