original_string: public function findRequiredTokens(FinderInterface $finder, array $tokenCollection)
      {
          foreach ($tokenCollection as $fileTokens) {
              if (!$fileTokens->hasTokens()) {
                  continue;
              }
              $file = $this->plugin->directory.'/'.$fileTokens->file;
  
              if (!file_exists($file)) {
                  $this->addWarning(sprintf('Skipping validation of missing or optional file: %s', $fileTokens->file));
                  continue;
              }
  
              try {
                  $finder->findTokens($file, $fileTokens);
                  $this->addMessagesFromTokens($finder->getType(), $fileTokens);
              } catch (\Exception $e) {
                  $this->addError($e->getMessage());
              }
          }
      }
code: public function findRequiredTokens(FinderInterface $finder, array $tokenCollection)
      {
          foreach ($tokenCollection as $fileTokens) {
              if (!$fileTokens->hasTokens()) {
                  continue;
              }
              $file = $this->plugin->directory.'/'.$fileTokens->file;
  
              if (!file_exists($file)) {
                  $this->addWarning(sprintf('Skipping validation of missing or optional file: %s', $fileTokens->file));
                  continue;
              }
  
              try {
                  $finder->findTokens($file, $fileTokens);
                  $this->addMessagesFromTokens($finder->getType(), $fileTokens);
              } catch (\Exception $e) {
                  $this->addError($e->getMessage());
              }
          }
      }
code_tokens: public function findRequiredTokens ( FinderInterface $ finder , array $ tokenCollection ) { foreach ( $ tokenCollection as $ fileTokens ) { if ( ! $ fileTokens -> hasTokens ( ) ) { continue ; } $ file = $ this -> plugin -> directory . '/' . $ fileTokens -> file ; if ( ! file_exists ( $ file ) ) { $ this -> addWarning ( sprintf ( 'Skipping validation of missing or optional file: %s' , $ fileTokens -> file ) ) ; continue ; } try { $ finder -> findTokens ( $ file , $ fileTokens ) ; $ this -> addMessagesFromTokens ( $ finder -> getType ( ) , $ fileTokens ) ; } catch ( \ Exception $ e ) { $ this -> addError ( $ e -> getMessage ( ) ) ; } } }
docstring: Find required tokens in a file.
  
  @param FinderInterface $finder
  @param FileTokens[]    $tokenCollection
docstring_tokens: Find required tokens in a file .