diff --git a/arcanist/linter/CppVoidParameterLinter.php b/arcanist/linter/CppVoidParameterLinter.php index 07e0c60ae..bcd0e347f 100644 --- a/arcanist/linter/CppVoidParameterLinter.php +++ b/arcanist/linter/CppVoidParameterLinter.php @@ -1,75 +1,75 @@ ArcanistLintSeverity::SEVERITY_AUTOFIX, ); } public function getLintNameMap() { return array( self::VOID_PARAMETER_FOUND => pht('Use C++ style void parameters.'), ); } private function isFalsePositive($line) { foreach(self::FALSE_POSITIVES as $falsePositive) { if (strpos($line, $falsePositive) !== false) { return true; } } return false; } public function lintPath($path) { $absPath = Filesystem::resolvePath($path, $this->getProjectRoot()); $fileContent = Filesystem::readFile($absPath); - if (preg_match_all('/\S+\s?\(void\)/', $fileContent, $voidParameters, + if (preg_match_all('/[^\s{]+\s?\(void\)/', $fileContent, $voidParameters, PREG_OFFSET_CAPTURE)) { foreach ($voidParameters[0] as $voidParameter) { list($function, $offset) = $voidParameter; if ($this->isFalsePositive($function)) { continue; } $this->raiseLintAtOffset( $offset, self::VOID_PARAMETER_FOUND, pht('C++ style parameters should be used: () instead of (void).'), $function, str_replace('(void)', '()', $function) )->setBypassChangedLineFiltering(true); } } } }