To me, the exception handler should be as light as possible to be sure it will not fail. In OOM situation, this call to highlight_file() might be too heavy. I'd prefer replacing it with fopen+fgets. Color support is not required anymore here since most of the time, https://github.com/symfony/symfony/pull/10725 will replace the output and provide colors.