rfc:tidyexception-for-tidy
PHP RFC: TidyException type for tidy
- Version: 0.1
- Date: 2025-10-26
- Author: devnexen, devnexen@gmail.com
- Status: Draft
- Implementation: https://github.com/php/php-src/pull/19417/files
Introduction
The goal is to allow the tidy extension to have its own exception type, TidyException, with which can be used for the tidy(p) C api usage, thinking about this while working at updating tidy to throw exception rather than raising warnings.
Proposal
Nothing fancy, the TidyException would be as follow :
class TidyException extends Exception { }
Examples
try { $tidy->parseFile("does_not_exist.html"); } catch (TidyException $e) { // Cannot load "does_not_exist.html" into memory echo $e->getMessage(), PHP_EOL; }
Backward Incompatible Changes
- Before, the extension did not raise an exception, that's the opportunity to create this new exception.
Proposed PHP Version(s)
- next PHP 8.x
RFC Impact
- none outside of the tidy extension
rfc/tidyexception-for-tidy.txt · Last modified: by devnexen