In plain English: A catch block that is left completely empty without handling or logging the caught exception.
Why it matters: Catching an exception and doing nothing with it (“swallowing” the error) hides bugs, failed database queries, or invalid inputs. When something goes wrong, your application will fail silently or behave unpredictably without leaving any trace in your logs.
try {
$this->saveUser($data);
} catch (Exception $e) {
// Empty catch block! Error is swallowed silently.
}
try {
$this->saveUser($data);
} catch (DatabaseException $e) {
// Log the error and rethrow or handle it appropriately
Log::error("Failed to save user: " . $e->getMessage());
throw new UserSaveFailedException("Could not save user.", 0, $e);
}
try...catch blocks where the catch body contains no statements.E0002 has no configuration options and is enabled by default.
Never leave a catch block empty. If an exception happens, at minimum log it or handle it so bugs don’t fail silently!