<?php
class AException extends \Exception {}
class T extends \RuntimeException{
public function __construct($message, AException $e) {
parent::__construct($message, $e->getCode(), $e);
}
}
throw new T("CRAP", new AException);
Fatal error: Uncaught AException in /in/4aMUq:10
Stack trace:
#0 {main}
Next T: CRAP in /in/4aMUq:10
Stack trace:
#0 {main}
thrown in /in/4aMUq on line 10
Process exited with code 255.