|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2011-10-28 18:45 UTC] nikic@php.net
Description: ------------ When implementing an interface which extends Traversable together with one of the concrete Traversable implementations (i.e. Iterator or IteratorAggregate) the latter must be named first in order to not throw an error. Compare: http://codepad.viper-7.com/OJt8XN http://codepad.viper-7.com/1AnU5Z Responsible code: http://lxr.php.net/xref/PHP_5_4/Zend/zend_interfaces.c#zend_implement_traversable PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 09:00:01 2025 UTC |
The order dependency of interface names is a minor drawback, but same thing happens when one tries to put an abstract class between the interface and specific implementation. And this is a big problem: <?php interface IFoo extends \Traversable {} abstract class AFoo implements IFoo {} ?> Throws: Class AFoo must implement interface Traversable as part of either Iterator or IteratorAggregate in Unknown on line 0