phanalist

E0048: Unbounded Direct Recursion

E0048 reports direct recursion that reuses unchanged arguments and does not reassign the corresponding parameters. These calls are strong candidates for infinite recursion.

What it checks

A recursive call is accepted when it changes an argument, for example countdown($number - 1), or when the function mutates the parameter before the call. Mutations include direct assignment, ++/--, array element writes, property writes on parameter objects, unset(), foreach targets, and builtins that mutate an argument such as array_pop(), array_shift(), sort(), or preg_match().

Recursion is also accepted when the function mutates object or static state, calls another method on $this before recursing, or places the recursive call in a closure that shadows a parameter name. A fully qualified call such as \getenv() is treated as the global function, not as a recursive call to a namespaced getenv() function.

Model limits

E0048 is a local, conservative heuristic:

Configuration

E0048 has no configuration options and is enabled by default.