Skip to content
Snippets Groups Projects
Commit f16baca7 authored by Peter Rotich's avatar Peter Rotich
Browse files

Merge pull request #3072 from greezybacon/issue/php54-inlinefunc-this


lint: Allow $this inside anonymous functions

Reviewed-By: default avatarPeter Rotich <peter@osticket.com>
parents 03d17af3 14de7071
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