xref: /PHP-7.0/Zend/tests/return_types/013.phpt (revision e97d5fab)
1--TEST--
2Closure inside method returned null, expected array
3
4--FILE--
5<?php
6class foo {
7    public function bar() : callable {
8        $test = "one";
9        return function() use($test) : array {
10            return null;
11        };
12    }
13}
14
15$baz = new foo();
16var_dump($func=$baz->bar(), $func());
17
18--EXPECTF--
19Fatal error: Uncaught TypeError: Return value of foo::{closure}() must be of the type array, null returned in %s:%d
20Stack trace:
21#0 %s(%d): foo->{closure}()
22#1 {main}
23  thrown in %s on line %d
24