1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
--TEST-- self return type on closure in a method --FILE-- <?php class A { public function test() { return function() : self { return $this; }; } } var_dump((new A)->test()()); ?> --EXPECT-- object(A)#1 (0) { }