public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); $matcher = new FileCommentMatcher(); if ($matcher->matches($tokens, $stackPtr)) { // stand-alone file comment $phpcsFile->addError('Class file should not have a file comment', $stackPtr); } }
/** * @test * @dataProvider tokensProvider */ public function it_matches_a_file_comment(array $tokens, $tokenIndex, $expectedToMatch) { $matcher = new FileCommentMatcher(); $this->assertSame($expectedToMatch, $matcher->matches($tokens, $tokenIndex)); }