diff --git a/src/lint/linter/ArcanistPhpLinter.php b/src/lint/linter/ArcanistPhpLinter.php --- a/src/lint/linter/ArcanistPhpLinter.php +++ b/src/lint/linter/ArcanistPhpLinter.php @@ -63,8 +63,8 @@ // Combine $stdout and $stderr for consistency $stdout = $stderr."\n".$stdout; $matches = array(); - $regex = '/PHP (?.+?) error:\s+(?.*?)\s+in\s+(?.*?)'. - '\s+on line\s+(?\d*)/'; + $regex = '/^(?.+?) error:\s+(?.*?)\s+in\s+(?.*?)'. + '\s+on line\s+(?\d*)$/m'; if (preg_match($regex, $stdout, $matches)) { $type = strtolower($matches['type']); $message = new ArcanistLintMessage(); diff --git a/src/lint/linter/ArcanistXHPASTLinter.php b/src/lint/linter/ArcanistXHPASTLinter.php --- a/src/lint/linter/ArcanistXHPASTLinter.php +++ b/src/lint/linter/ArcanistXHPASTLinter.php @@ -1902,9 +1902,13 @@ $statics = $def->selectDescendantsOfType('n_CLASS_STATIC_ACCESS'); foreach ($statics as $static) { $rhs = $static->getChildByIndex(1); - $rhs_vars = $def->selectDescendantsOfType('n_VARIABLE'); - foreach ($rhs_vars as $var) { - $exclude_tokens[$var->getID()] = true; + if ($rhs->getTypeName() == 'n_VARIABLE') { + $exclude_tokens[$rhs->getID()] = true; + } else { + $rhs_vars = $rhs->selectDescendantsOfType('n_VARIABLE'); + foreach ($rhs_vars as $var) { + $exclude_tokens[$var->getID()] = true; + } } } diff --git a/src/lint/linter/__tests__/xhpast/naming-conventions.lint-test b/src/lint/linter/__tests__/xhpast/naming-conventions.lint-test --- a/src/lint/linter/__tests__/xhpast/naming-conventions.lint-test +++ b/src/lint/linter/__tests__/xhpast/naming-conventions.lint-test @@ -48,6 +48,13 @@ Other::$Y_y[0]; parent::$Z_z[0]; } + +function j() { + // Test case for bug where any static access would shadow other variables. + Other::$y = 0; + $mIxEdCaSe = 1; +} + ~~~~~~~~~~ warning:2:13 warning:3:9 @@ -65,3 +72,4 @@ warning:30:3 warning:31:3 warning:33:3 +warning:55:3