PDepend\Source\Language\PHP\PHPTokenizerInternal::setSourceFile PHP Method

setSourceFile() public method

Sets a new php source file.
public setSourceFile ( string $sourceFile ) : void
$sourceFile string A php source file.
return void
    public function setSourceFile($sourceFile)
    {
        $this->tokens = null;
        $this->sourceFile = new ASTCompilationUnit($sourceFile);
    }

Usage Example

 /**
  * This method tests that the parser does not substitute keyword tokens in
  * a class or object operator chain.
  *
  * @param string         $sourceFile Name of the text file.
  * @param array(integer) $tokenTypes List of all expected token types.
  *
  * @return void
  * @dataProvider dataProviderTokenizerKeywordSubstitutionInOperatorChain
  */
 public function testTokenizerKeywordSubstitutionInOperatorChain($sourceFile, array $tokenTypes)
 {
     $tokenizer = new PHPTokenizerInternal();
     $tokenizer->setSourceFile($this->createCodeResourceURI($sourceFile));
     $actual = array();
     while (is_object($token = $tokenizer->next())) {
         $actual[] = $token->type;
     }
     $this->assertEquals($tokenTypes, $actual);
 }
All Usage Examples Of PDepend\Source\Language\PHP\PHPTokenizerInternal::setSourceFile