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