Beispiel #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');
     $cache = new PHP_Depend_Util_Cache_Driver_Memory();
     $builder = new PHP_Depend_Builder_Default();
     $tokenizer = new PHP_Depend_Tokenizer_Internal();
     $tokenizer->setSourceFile(self::createCodeResourceUriForTest());
     $parser = new PHP_Depend_Parser_VersionAllParser($tokenizer, $builder, $cache);
     $parser->setMaxNestingLevel(512);
     $parser->parse();
 }
Beispiel #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_Internal();
     $this->fireStartParseProcess($this->builder);
     foreach ($this->createFileIterator() as $file) {
         $tokenizer->setSourceFile($file);
         $parser = new PHP_Depend_Parser_VersionAllParser($tokenizer, $this->builder, $this->cacheFactory->create());
         $parser->setMaxNestingLevel($this->configuration->parser->nesting);
         // 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);
 }