Extending SplDoublyLinkedList with specific child types and avoiding strict notices

From: Date: Mon, 20 Mar 2017 18:57:01 +0000
Subject: Extending SplDoublyLinkedList with specific child types and avoiding strict notices
Groups: php.general 
Request: Send a blank email to php-general+get-326024@lists.php.net to get a copy of this message
Hopefully the title says it all. Basically I'm extending the SplDoublyLinkedList as it's better on memory than arrays, is object orientated, and it can be extended with additional functionality more easily. It's that last part that is causing some issues. I'm extending to create a list class that only takes specific children. This example will throw PHP strict notices when run, which I ideally want to avoid: <?php class SomeSpecificListClass extends \SplDoublyLinkedList { public class push(SpecificChildTypeClass $item) { parent::push($item); } } Has anyone else tried something like this before and found a better way? Thanks, Ash http://www.ashleysheridan.co.uk

« previous php.general (#326024) next »