From 6eabf47c0cbffff546ea3a11180512454da3884d Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Mon, 20 Jan 2014 18:16:27 -0600 Subject: [PATCH] lint: Properly analyze PHP abstract functions --- setup/test/tests/class.php_analyze.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/setup/test/tests/class.php_analyze.php b/setup/test/tests/class.php_analyze.php index 153c9ad11..53e0a85ab 100644 --- a/setup/test/tests/class.php_analyze.php +++ b/setup/test/tests/class.php_analyze.php @@ -73,13 +73,19 @@ class SourceAnalyzer extends Test { $scope = array(); while ($token != "{") { list(,$token) = each($this->tokens); - if (!is_array($token) - || $token[0] == T_WHITESPACE) + switch ($token[0]) { + case T_WHITESPACE: continue; - if ($token[0] == T_STRING) + case T_STRING: $function['name'] = $token[1]; - elseif ($token[0] == T_VARIABLE) + break; + case T_VARIABLE: $scope[$token[1]] = 1; + break; + case ';': + // Abstract function -- no body will follow + return; + } } // Start inside a block -- we've already consumed the { $this->checkVariableUsage($function, $scope, 1, $options); -- GitLab