1--TEST-- 2never type of __toString method 3--FILE-- 4<?php 5 6class A implements Stringable { 7 public function __toString(): string { 8 return "hello"; 9 } 10} 11 12class B extends A { 13 public function __toString(): never { 14 throw new \Exception('not supported'); 15 } 16} 17 18try { 19 echo (string) (new B()); 20} catch (Exception $e) { 21 // do nothing 22} 23 24echo "done"; 25 26?> 27--EXPECT-- 28done 29