summaryrefslogtreecommitdiff
path: root/Zend/tests/return_types/013.phpt
blob: 673a8f9dbcdbf8ca6cdbf4bcca05c08df194d043 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
--TEST--
Closure inside method returned null, expected array

--FILE--
<?php
class foo {
    public function bar() : callable {
        $test = "one";
        return function() use($test) : array {
            return null;
        };
    }
}

$baz = new foo();
var_dump($func=$baz->bar(), $func());

--EXPECTF--
Fatal error: Uncaught TypeError: Return value of foo::{closure}() must be of the type array, null returned in %s:%d
Stack trace:
#0 %s(%d): foo->{closure}()
#1 {main}
  thrown in %s on line %d