switch statements are difficult to understand and affect code readability. In addition, it is considered a code smell since they are harder to maintain and can easily be confused with the outer
switch statement. Therefore it is recommended to avoid using nested
switch statements or consider moving the inner
switch to another function/method.
This issue is raised when a function is declared inside another function or method. The nested function is always created in the global scope and not in the enclosing function or method's scope.
This will also lead to a
Fatal Error during runtime if the enclosing function or method is called more than once.
This happens because the enclosed function is defined in the Global scope when the enclosing function is called the first time. On subsequent calls, PHP will find the enclosed function already defined and run into an error.
It is therefore recommended to refactor it to an anonymous function/closure, class method, or a top-level-defined function.
The class contains unused private methods. These private class methods are dead code, and do nothing. It is recommended to remove these unused private methods.
It is also recommended that you review these unused private methods if they were added for later use in the code, but the author missed using them.
The constructor signature contains one or more unused parameters. Since these are nowhere used in the class, it can be safely removed.
An empty block is considered as dead code as it doesn't do anything. The issue is raised when loops, conditionals, or other statements contains empty body which implies some piece of code is missing.
It is advised to remove the empty block since keeping them in the codebase wastes computation time and memory.