This rule raises an issue when a function call result is used, even though the function does not return anything.

Why is this an issue?

If a function does not return anything, it makes no sense to use its output. Specifically, passing it to another function, or assigning its "result" to a variable is probably a bug because such functions return nothing, which is probably not what was intended.

Code examples

Noncompliant code example

$result = closedir($dir_handle); // Noncompliant, "closedir" does not return anything.

Compliant solution

closedir($dir_handle);

Resources

Documentation