Exemple #1
0
 /**
  * testParserHandlesMaxNestingLevel
  * 
  * @return void
  * @covers PHP_Depend_Parser
  * @group pdepend
  * @group pdepend::parser
  * @group unittest
  */
 public function testParserHandlesMaxNestingLevel()
 {
     if (version_compare(phpversion(), '5.2.10') < 0) {
         $this->markTestSkipped();
     }
     ini_set('xdebug.max_nesting_level', '100');
     $builder = new PHP_Depend_Builder_Default();
     $tokenizer = new PHP_Depend_Tokenizer_Internal();
     $tokenizer->setSourceFile(self::createCodeResourceURI('parser/' . __FUNCTION__ . '.php'));
     $parser = new PHP_Depend_Parser($tokenizer, $builder);
     $parser->setMaxNestingLevel(512);
     $parser->parse();
 }
Exemple #2
0
 /**
  * This method performs the parsing process of all source files. It expects
  * that the <b>$_builder</b> property was initialized with a concrete builder
  * implementation.
  *
  * @return void
  */
 private function _performParseProcess()
 {
     // Reset list of thrown exceptions
     $this->_parseExceptions = array();
     $tokenizer = new PHP_Depend_Tokenizer_CacheDecorator(new PHP_Depend_Tokenizer_Internal());
     $this->fireStartParseProcess($this->_builder);
     foreach ($this->_createFileIterator() as $file) {
         $tokenizer->setSourceFile($file);
         $parser = new PHP_Depend_Parser($tokenizer, $this->_builder);
         $parser->setMaxNestingLevel(1024);
         // Disable annotation parsing?
         if ($this->_withoutAnnotations === true) {
             $parser->setIgnoreAnnotations();
         }
         $this->fireStartFileParsing($tokenizer);
         try {
             $parser->parse();
         } catch (PHP_Depend_Parser_Exception $e) {
             $this->_parseExceptions[] = $e;
         }
         $this->fireEndFileParsing($tokenizer);
     }
     $this->fireEndParseProcess($this->_builder);
 }