1--TEST--
2ReflectionType leak
3--FILE--
4<?php
5
6$closure = function(Test $x): Test2 { return new Test2($x); };
7$rm = new ReflectionMethod($closure, '__invoke');
8$rp = $rm->getParameters()[0];
9$rt = $rp->getType();
10$rrt = $rm->getReturnType();
11unset($rm, $rp);
12var_dump($rt->getName(), $rrt->getName());
13?>
14--EXPECT--
15string(4) "Test"
16string(5) "Test2"
17