summaryrefslogtreecommitdiff
path: root/Zend/tests/return_types/006.phpt
blob: 359b25a28df3c5e0414f5f91e68c6fad2c15d0ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
--TEST--
Return type allowed in child when parent does not have return type

--FILE--
<?php
class Comment {}

class CommentsIterator extends ArrayIterator implements Iterator {
    function current() : Comment {
        return parent::current();
    }
}

$comments = new CommentsIterator([new Comment]);
foreach ($comments as $comment) {
    var_dump($comment);
}

--EXPECTF--
object(Comment)#%d (%d) {
}