Skip to content

Commit

Permalink
lint: Allow $this inside anonymous functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Jared Hancock committed Apr 24, 2016
1 parent 28e6c2e commit 14de707
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions setup/test/tests/class.php_analyze.php
Expand Up @@ -201,11 +201,10 @@ function checkVariableUsage($function, $scope=array(), $blocks=0,
// 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);
Expand Down

0 comments on commit 14de707

Please sign in to comment.