SensioLabs\DeprecationDetector\Finder\ParsedPhpFileFinder::parsePhpFiles PHP Method

parsePhpFiles() public method

public parsePhpFiles ( string $path ) : Result
$path string
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);
    }

Usage Example

 /**
  * @param string  $path
  * @param RuleSet $ruleSet
  *
  * @return RuleSet
  */
 public function traverse($path, RuleSet $ruleSet = null)
 {
     $result = $this->finder->parsePhpFiles($path);
     if (!$ruleSet instanceof RuleSet) {
         $ruleSet = new RuleSet();
     }
     foreach ($result->parsedFiles() as $file) {
         if ($file->hasDeprecations()) {
             $ruleSet->merge($file);
         }
     }
     return $ruleSet;
 }
All Usage Examples Of SensioLabs\DeprecationDetector\Finder\ParsedPhpFileFinder::parsePhpFiles
ParsedPhpFileFinder