1--TEST-- 2never return type: prevent unacceptable cases 3--FILE-- 4<?php 5 6class A 7{ 8 public function bar(): never 9 { 10 throw new \Exception('parent'); 11 } 12} 13 14class B extends A 15{ 16 public function bar(): string 17 { 18 return "hello"; 19 } 20} 21 22(new B)->bar(); 23 24?> 25--EXPECTF-- 26Fatal error: Declaration of B::bar(): string must be compatible with A::bar(): never in %s on line %d 27