xref: /PHP-7.4/Zend/tests/return_types/012.phpt (revision d679f022)
1--TEST--
2Method returned callable, expected callable
3--FILE--
4<?php
5class foo {
6    public function bar() : callable {
7        $test = "one";
8        return function() use($test) : array {
9            return array($test);
10        };
11    }
12}
13
14$baz = new foo();
15var_dump($baz->bar());
16--EXPECT--
17object(Closure)#2 (2) {
18  ["static"]=>
19  array(1) {
20    ["test"]=>
21    string(3) "one"
22  }
23  ["this"]=>
24  object(foo)#1 (0) {
25  }
26}
27