Пример #1
0
 /**
  * Creates a new FileReflector for the given filename or null if the file contains no modifications.
  *
  * @param ProjectDescriptorBuilder $builder
  * @param string                   $filename
  *
  * @return FileReflector|null Returns a new FileReflector or null if no modifications were detected for the given
  *     filename.
  */
 protected function createFileReflector(ProjectDescriptorBuilder $builder, $filename)
 {
     $file = new FileReflector($filename, $this->parser->doValidation(), $this->parser->getEncoding());
     $file->setDefaultPackageName($this->parser->getDefaultPackageName());
     $file->setMarkers($this->parser->getMarkers());
     $file->setFilename($this->getRelativeFilename($filename));
     $cachedFiles = $builder->getProjectDescriptor()->getFiles();
     $hash = $cachedFiles->get($file->getFilename()) ? $cachedFiles->get($file->getFilename())->getHash() : null;
     return $hash === $file->getHash() && !$this->parser->isForced() ? null : $file;
 }
Пример #2
0
 /**
  * @covers phpDocumentor\Parser\Parser::setEncoding
  * @covers phpDocumentor\Parser\Parser::getEncoding
  */
 public function testSettingAndRetrievingTheEncodingOfTheProvidedFiles()
 {
     $this->assertEquals('utf-8', $this->fixture->getEncoding());
     $this->fixture->setEncoding('iso-8859-1');
     $this->assertEquals('iso-8859-1', $this->fixture->getEncoding());
 }