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