website/errors/catch.deprecatedEnum.md
<?php declare(strict_types = 1);
/** @deprecated Use NewException instead. */
enum AppError: string implements \Throwable
{
// ...
}
try {
// ...
} catch (AppError $e) {
// ...
}
The catch clause references an enum that has been marked with a @deprecated PHPDoc tag. The enum is scheduled for removal or replacement, and any usage of it -- including catching it -- should be migrated to the recommended alternative.
This rule is provided by the phpstan-deprecation-rules package.
Replace the deprecated enum with its recommended replacement as indicated in the deprecation message:
<?php declare(strict_types = 1);
try {
// ...
-} catch (AppError $e) {
+} catch (NewException $e) {
// ...
}