public function testParseFile()
 {
     $phpFileInfo = $this->prophesize('SensioLabs\\DeprecationDetector\\FileInfo\\PhpFileInfo');
     $phpFileInfo->getContents()->willReturn('');
     $phpFileInfo = $phpFileInfo->reveal();
     $violationVisitor = $this->prophesize('SensioLabs\\DeprecationDetector\\Visitor\\ViolationVisitorInterface')->reveal();
     $baseTraverser = $this->prophesize('PhpParser\\NodeTraverser');
     $baseTraverser->traverse(array())->willReturn(array())->shouldBeCalled();
     $staticAnalysisTraverser = $this->prophesize('PhpParser\\NodeTraverser');
     $staticAnalysisTraverser->traverse(array())->willReturn(array())->shouldBeCalled();
     $violationTraverser = $this->prophesize('PhpParser\\NodeTraverser');
     $violationTraverser->addVisitor($violationVisitor)->shouldBeCalled();
     $violationTraverser->traverse(array())->shouldBeCalled();
     $deprecationParser = new UsageParser(array(), array($violationVisitor), $baseTraverser->reveal(), $staticAnalysisTraverser->reveal(), $violationTraverser->reveal());
     $deprecationParser->parseFile($phpFileInfo);
 }
 /**
  * @param $type
  * @param $name
  *
  * @return PhpFileInfo|null
  */
 protected function findDefinitionFileByRegex($type, $name)
 {
     $namespaceParts = explode('\\', $name);
     $definition = sprintf('%s %s[;\\{\\s]', $type, array_pop($namespaceParts));
     if (count($namespaceParts) > 0) {
         $namespace = sprintf('namespace %s', implode('\\\\', $namespaceParts));
     } else {
         $namespace = '';
     }
     $files = new Finder();
     $files->name('*.php')->contains(sprintf('/%s.*%s/s', $namespace, $definition))->in($this->sourcePaths);
     if (!$namespace) {
         $files->notContains('/namespace\\s[^;]+/');
     }
     $file = current(iterator_to_array($files));
     if (!$file instanceof SplFileInfo) {
         return;
     }
     $baseFile = PhpFileInfo::create($file);
     return $this->usageParser->parseFile($baseFile);
 }