1--TEST-- 2never return type: unacceptable cases: implicit return in a method 3--FILE-- 4<?php 5 6class Foo { 7 public static function bar(): never { 8 if (false) { 9 throw new Exception('bad'); 10 } 11 } 12} 13 14try { 15 Foo::bar(); 16} catch (TypeError $e) { 17 echo $e->getMessage() . "\n"; 18} 19?> 20--EXPECT-- 21Foo::bar(): never-returning method must not implicitly return 22