Req #62609 [Asn->Csd]: Allow implementing Traversable on abstract classes

From: Date: Fri, 06 Mar 2020 10:12:53 +0000
Subject: Req #62609 [Asn->Csd]: Allow implementing Traversable on abstract classes
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-225919@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=62609&edit=1 ID: 62609 Updated by: nikic@php.net Reported by: mateusz dot charytoniuk at gmail dot com Summary: Allow implementing Traversable on abstract classes -Status: Assigned +Status: Closed Type: Feature/Change Request Package: SPL related Operating System: Debian wheezy/sid 3.2.0-3-amd64 PHP Version: 5.4.4 Assigned To: nikic Block user comment: N Private report: N New Comment: Automatic comment on behalf of nikita.ppv@gmail.com Revision: http://git.php.net/?p=php-src.git;a=commit;h=e9ae581f024e06878b2b1991b7daed6318c811a7 Log: Fixed bug #62609: Allow implementing Traversable in abstract class Previous Comments: ------------------------------------------------------------------------ [2015-01-09 01:18:54] danack@php.net This appears to be a bug not a feature request, as it should be possible. e.g. in the code below the userland interface + abstract class is fine. But the internal interface and abstract class is not fine. <?php interface foo { public function bar(); } abstract class b implements foo {} //compiles fine abstract class a implements Traversable {} //PHP Fatal error: Class a must implement interface Traversable as part of either Iterator or IteratorAggregate in Unknown on line 0 ------------------------------------------------------------------------ [2012-07-19 12:12:30] mateusz dot charytoniuk at gmail dot com Description: ------------ --- From manual page: http://www.php.net/class.traversable --- It would be interesting if one could add 'implements Traversable' to abstract class and then (in deriving classess) implement it either as Iterator or IteratorAggregate. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=62609&edit=1

« previous php.bugs (#225919) next »