summaryrefslogtreecommitdiff
path: root/Zend/tests/return_types/inheritance009.phpt
blob: b7d5628e8d5da3621174ce78651d535fb6d6b696 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
--TEST--
Inheritance Hinting Compile Checking Failure Internal Classes
--INI--
opcache.enable_cli=1
--FILE--
<?php
class Foo {
    public static function test() : Traversable {
        return new ArrayIterator([1, 2]);
    }
}

class Bar extends Foo {
    public static function test() : Traversable {
        return new ArrayObject([1, 2]);
    }
}

var_dump(Bar::test());
var_dump(Foo::test());
--EXPECTF--
object(ArrayObject)#%d (1) {
  ["storage":"ArrayObject":private]=>
  array(2) {
    [0]=>
    int(1)
    [1]=>
    int(2)
  }
}
object(ArrayIterator)#%d (1) {
  ["storage":"ArrayIterator":private]=>
  array(2) {
    [0]=>
    int(1)
    [1]=>
    int(2)
  }
}