1--TEST-- 2Adding a class method object return type 3--FILE-- 4<?php 5 6interface One { 7 public function a() : object; 8} 9 10class Two implements One { 11 public function a() : object {} 12} 13 14$three = new class extends Two { 15 public function a() : object { 16 return 12345; 17 } 18}; 19$three->a(); 20--EXPECTF-- 21Fatal error: Uncaught TypeError: Return value of class@anonymous::a() must be an object, integer returned in %s:13 22Stack trace: 23#0 %s(16): class@anonymous->a() 24#1 {main} 25 thrown in %s on line 13 26