From 14de707159927ca46b11c4732bc60a334adc3093 Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Sun, 24 Apr 2016 17:43:02 -0500 Subject: [PATCH] lint: Allow $this inside anonymous functions --- setup/test/tests/class.php_analyze.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/setup/test/tests/class.php_analyze.php b/setup/test/tests/class.php_analyze.php index 53e0a85ab..1ed22fe1a 100644 --- a/setup/test/tests/class.php_analyze.php +++ b/setup/test/tests/class.php_analyze.php @@ -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); -- GitLab