/** * Processes this test, when one of its tokens is encountered. Overrides to relax some * requirements. * * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. * @param int $stackPtr The position of the current token * in the stack passed in $tokens. * * @return void */ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) { // Relaxations for joind.in $this->tags['author']['required'] = false; $this->tags['link']['required'] = false; $this->tags['version']['required'] = false; return parent::process($phpcsFile, $stackPtr); }
/** * Process tags inside the comment block. * * @param PHP_CodeSniffer_File $file * @param int $stackPtr * @param int $commentStart */ protected function processTags(PHP_CodeSniffer_File $file, $stackPtr, $commentStart) { $tokens = $file->getTokens(); $type = strtolower($tokens[$stackPtr]['content']); $firstComment = $tokens[$commentStart + 5]['content']; if ($type === 'class') { if (substr($firstComment, 0, 5) != 'Class') { $file->addError('First line should have form: "Class ClassName"', $commentStart + 5); } } elseif ($type == 'interface') { if (substr($firstComment, 0, 9) != 'Interface') { $file->addError('First line should have form: "Interface ClassName"', $commentStart + 5); } } parent::processTags($file, $stackPtr, $commentStart); }