xref: /PHP-7.1/Zend/tests/return_types/006.phpt (revision 113213f0)
1--TEST--
2Return type allowed in child when parent does not have return type
3--FILE--
4<?php
5class Comment {}
6
7class CommentsIterator extends ArrayIterator implements Iterator {
8    function current() : Comment {
9        return parent::current();
10    }
11}
12
13$comments = new CommentsIterator([new Comment]);
14foreach ($comments as $comment) {
15    var_dump($comment);
16}
17--EXPECTF--
18object(Comment)#%d (%d) {
19}
20