Skip to content
Snippets Groups Projects
Commit 14de7071 authored by Jared Hancock's avatar Jared Hancock
Browse files

lint: Allow $this inside anonymous functions

parent 28e6c2e2
No related branches found
No related tags found
No related merge requests found
......@@ -201,11 +201,10 @@ class SourceAnalyzer extends Test {
// PHP does not automatically nest scopes. Variables
// available inside the closure must be explictly defined.
// Therefore, there is no need to pass the current scope.
// However, $this is not allowed inside inline functions
// unless declared in the use () parameters.
// As of PHP 5.4, $this is added to the closure automatically
$this->traverseFunction(
array($token[2], $function['file']),
array('allow_this'=>false));
array('allow_this'=>true));
break;
case T_STATIC:
$c = current($this->tokens);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment