note 108171 added to language.oop5.interfaces

From: Date: Wed, 04 Apr 2012 15:08:50 +0000
Subject: note 108171 added to language.oop5.interfaces
Groups: php.notes 
Request: Send a blank email to php-notes+get-186962@lists.php.net to get a copy of this message
When implementing an interface that extends Traversable, not only you have to supply an implementation of Traversable (i.e. either Iterator or IteratorAggregate) and tell which one you implement. It also matters in which order the implemented interfaces are listed. Changing "implements Iterator, MyTraversable" to "implements MyTraversable, Iterator" in the following snippet fails as of PHP 5.3.10: <?php interface MyTraversable extends Traversable {} class MyClass implements Iterator, MyTraversable { // Implement Iterator public function rewind() {} public function valid() {} public function current() {} public function key() {} public function next() {} } ?> ---- Server IP: 80.67.10.227 Probable Submitter: 80.252.162.18 ---- Manual Page -- http://www.php.net/manual/en/language.oop5.interfaces.php Edit -- https://master.php.net/note/edit/108171 Del: integrated -- https://master.php.net/note/delete/108171/integrated Del: useless -- https://master.php.net/note/delete/108171/useless Del: bad code -- https://master.php.net/note/delete/108171/bad+code Del: spam -- https://master.php.net/note/delete/108171/spam Del: non-english -- https://master.php.net/note/delete/108171/non-english Del: in docs -- https://master.php.net/note/delete/108171/in+docs Del: other reasons-- https://master.php.net/note/delete/108171 Reject -- https://master.php.net/note/reject/108171 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#186962) next »