In PHP, nested functions are functions, which are defined inside other functions. They have access to the variables of the enclosing functions.
Once the parent function declares the nested function, the nested function becomes available to the global scope.
Code that uses nested functions can become difficult to read, refactor and to maintain and should therefore be avoided.
Noncompliant code example
With the default threshold of 3 level:
function f () {
function f_inner () {
function f_inner_inner() {
function f_inner_inner_inner() { // Noncompliant
}
}
}
}