public function testEndGeneratedOutputOnlyInVerboseMode()
 {
     $progressBar = $this->prophesize('Symfony\\Component\\Console\\Helper\\ProgressBar');
     $progressBar->clear()->shouldNotBeCalled();
     $progressBar->finish()->shouldNotBeCalled();
     $verboseProgressOutput = new VerboseProgressOutput($progressBar->reveal(), false, 'a progress bar label');
     $verboseProgressOutput->end();
 }
 /**
  * @return \Iterator
  */
 public function getIterator()
 {
     $iterator = parent::getIterator();
     $files = new \ArrayIterator();
     $total = $this->count();
     $this->progressOutput->start($total);
     $i = 0;
     foreach ($iterator as $file) {
         $file = PhpFileInfo::create($file);
         try {
             $this->progressOutput->advance(++$i, $file);
             $this->parser->parseFile($file);
         } catch (\PhpParser\Error $ex) {
             $raw = $ex->getRawMessage() . ' in file ' . $file;
             $ex->setRawMessage($raw);
             $this->parserErrors[] = $ex;
         }
         $files->append($file);
     }
     $this->progressOutput->end();
     return $files;
 }
 /**
  * @param string $path
  *
  * @return Result
  */
 public function parsePhpFiles($path)
 {
     $files = $this->finderFactory->createFinder()->in($path);
     $parsedFiles = array();
     $parserErrors = array();
     $this->progressOutput->start($fileCount = $files->count());
     $i = 0;
     foreach ($files->getIterator() as $file) {
         $file = PhpFileInfo::create($file);
         try {
             $this->progressOutput->advance(++$i, $file);
             $this->parser->parseFile($file);
         } catch (Error $ex) {
             $raw = $ex->getRawMessage() . ' in file ' . $file;
             $ex->setRawMessage($raw);
             $parserErrors[] = $ex;
         }
         $parsedFiles[] = $file;
     }
     $this->progressOutput->end();
     return new Result($parsedFiles, $parserErrors, $fileCount);
 }