Chris@0: getFilename(), -7)); Chris@0: // Only check in *.install files. Chris@0: if ($fileExtension !== 'install') { Chris@0: return; Chris@0: } Chris@0: Chris@0: $fileName = substr(basename($phpcsFile->getFilename()), 0, -8); Chris@0: $tokens = $phpcsFile->getTokens(); Chris@0: if ($tokens[$stackPtr]['content'] === ($fileName.'_install') Chris@0: || $tokens[$stackPtr]['content'] === ($fileName.'_uninstall') Chris@0: ) { Chris@0: // Check if there is a function body. Chris@0: $bodyPtr = $phpcsFile->findNext( Chris@17: Tokens::$emptyTokens, Chris@0: ($tokens[$functionPtr]['scope_opener'] + 1), Chris@0: $tokens[$functionPtr]['scope_closer'], Chris@0: true Chris@0: ); Chris@0: if ($bodyPtr === false) { Chris@0: $error = 'Empty installation hooks are not necessary'; Chris@0: $phpcsFile->addError($error, $stackPtr, 'EmptyInstall'); Chris@0: } Chris@0: } Chris@0: Chris@0: }//end processFunction() Chris@0: Chris@0: Chris@0: }//end class