process() public method

Processes this test, when one of its tokens is encountered.
public process ( PHP_CodeSniffer_File $phpcsFile, integer $stackPtr ) : void
$phpcsFile PHP_CodeSniffer_File The file being scanned.
$stackPtr integer The position of the current token in the stack passed in $tokens.
return void
 /**
  * Processes this test, when one of its tokens is encountered.
  *
  * @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)
 {
     // We want all the errors from the PSR2 standard, plus some of our own.
     parent::process($phpcsFile, $stackPtr);
     $tokens = $phpcsFile->getTokens();
     // Check that this is the only class or interface in the file.
     $nextClass = $phpcsFile->findNext(array(T_CLASS, T_INTERFACE), $stackPtr + 1);
     if ($nextClass !== false) {
         // We have another, so an error is thrown.
         $error = 'Only one interface or class is allowed in a file';
         $phpcsFile->addError($error, $nextClass, 'MultipleClasses');
     }
 }