diff --git a/Security/Sniffs/BadFunctions/NoEvalsSniff.php b/Security/Sniffs/BadFunctions/NoEvalsSniff.php index 80e0b62..c369686 100644 --- a/Security/Sniffs/BadFunctions/NoEvalsSniff.php +++ b/Security/Sniffs/BadFunctions/NoEvalsSniff.php @@ -26,8 +26,7 @@ public function register() { * @return void */ public function process(File $phpcsFile, $stackPtr) { - $tokens = $phpcsFile->getTokens(); - $error = 'Please do not use eval() functions'; + $error = 'Please do not use eval()'; $phpcsFile->addError($error, $stackPtr, 'NoEvals'); } diff --git a/Security/Tests/BadFunctions/NoEvalsUnitTest.inc b/Security/Tests/BadFunctions/NoEvalsUnitTest.inc new file mode 100644 index 0000000..5584268 --- /dev/null +++ b/Security/Tests/BadFunctions/NoEvalsUnitTest.inc @@ -0,0 +1,5 @@ + + */ + public function getErrorList() + { + return [ + 3 => 1, + 4 => 1, + 5 => 1, + ]; + } + + /** + * Returns the lines where warnings should occur. + * + * The key of the array should represent the line number and the value + * should represent the number of warnings that should occur on that line. + * + * @return array + */ + public function getWarningList() + { + return []; + } +}