note 73538 added to language.oop5.typehinting
| From: | ldebuyst-brutele dot be at osu1 dot php dot net | Date: | Wed, 28 Feb 2007 14:52:34 +0000 |
| Subject: | note 73538 added to language.oop5.typehinting | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-123949@lists.php.net to get a copy of this message | ||
In reply to Nikivich and Edorian:
Although it isn't quite clear from his post, I believe that the point nicholas is trying to
make is that, if you typehint an abstract function, you MUST use that same typehint for all classes
extending the abstract class.
As his example shows, if you typehint (Object $object), then you must use the exact same typehint
in the extending class. Using the typehint (Table $table) or (Chair $chair) will give fatal errors,
even if Table and Chair are subclasses of Object.
In other words, type hinting allows for descendants, as caliban at darklock dot com has shown,
except when you're subclassing.
See http://bugs.php.net/bug.php?id=36601 for a
bit more info. Flagged as wontfix, though, so something to keep in mind.
----
Server IP: 193.190.198.20
Probable Submitter: 217.136.223.121
----
Manual Page -- http://www.php.net/manual/en/language.oop5.typehinting.php
Edit -- https://master.php.net/note/edit/73538
Del: integrated -- https://master.php.net/note/delete/73538/integrated
Del: useless -- https://master.php.net/note/delete/73538/useless
Del: bad code -- https://master.php.net/note/delete/73538/bad+code
Del: spam -- https://master.php.net/note/delete/73538/spam
Del: non-english -- https://master.php.net/note/delete/73538/non-english
Del: in docs -- https://master.php.net/note/delete/73538/in+docs
Del: other reasons-- https://master.php.net/note/delete/73538
Reject -- https://master.php.net/note/reject/73538
Search -- https://master.php.net/manage/user-notes.php