lintUndeclaredVariables in XHPASTLinter will currently raise issues on most closures used within methods/functions.
E.g.:
function test() { $x = function($y) { return $y + 1; }; }
or
function test() { array_map(function($y) { return $y + 1; }, array(1, 2)); }
will state $y as undeclared in the surrounding function test() for both cases.
The closures itself will be linted correctly but the closure parameter will be treated like a variable in the surrounding function.
There already is a TODO comment in the linter function in question but i did not find a corresponding task for it.:
// TODO: Support functions defined inside other functions which is commonly // used with anonymous functions.
Unfortunately this seems to be a bit tricky to implement properly as it will probably change the whole way the linter function currently works but maybe someone has a quick fix (just ignoring these functions/function parameters?)