Exception handling provides a way to help developers handle and recover from runtime errors and unexpected events during program execution. When an
error occurs, an exception is thrown and can be caught by an appropriate try-catch block, allowing the program to handle the exception and prevent the
program from crashing.
A problem arises, when an exception or error class — an instance of Throwable
— in a catch clause does not exist, as PHP won’t
generate an error.
This typically occurs when being in a namespace trying to catch PHP built-in exception classes without escaping to the global namespace or
importing the classes.
In summary, this rule raises an issue when, being in a namespace, an undefined class belonging to that namespace is caught.
What is the potential impact?
Initially, since the exception is not being caught, it will cause a runtime error in production.
Additionally, this can lead to complex debugging problems as the root cause of the issue may not be obvious.