1--TEST-- 2Return value fails inheritance check in method 3 4--FILE-- 5<?php 6class foo {} 7 8class qux { 9 public function foo() : foo { 10 return $this; 11 } 12} 13 14$qux = new qux(); 15$qux->foo(); 16 17--EXPECTF-- 18Fatal error: Uncaught TypeError: Return value of qux::foo() must be an instance of foo, instance of qux returned in %s:%d 19Stack trace: 20#0 %s(%d): qux->foo() 21#1 {main} 22 thrown in %s on line %d 23