Running PHP CodeSniffer on the below snippet:
return array_filter($methods, function ($method) {
return in_array(
strtolower($method['type']),
self::$types
);
});
I get this error message:
Use of self::$types inside closure.
What exactly is the error reported (why I can't use self::$types
inside the closure) and how to solve it?
Note: the code is perfectly working anyway. The reported error is from CodeSniffer (not a PHP error).