/**
  * This method will add all assertions any ancestral structures (parent classes, implemented interfaces) might have
  * to the passed class definition.
  *
  * @param \AppserverIo\Doppelgaenger\Entities\Definitions\ClassDefinition $classDefinition The class definition we have to
  *                                                                                add the assertions to
  *
  * @return null
  */
 protected function addAncestralAssertions(ClassDefinition $classDefinition)
 {
     $dependencies = $classDefinition->getDependencies();
     foreach ($dependencies as $dependency) {
         // freshly set the dependency definition to avoid side effects
         $dependencyDefinition = null;
         $fileEntry = $this->structureMap->getEntry($dependency);
         if (!$fileEntry instanceof Structure) {
             // Continue, don't fail as we might have dependencies which are not under Doppelgaenger surveillance
             continue;
         }
         // Get the needed parser
         $structureParserFactory = new StructureParserFactory();
         $parser = $structureParserFactory->getInstance($fileEntry->getType(), $fileEntry->getPath(), $this->config, $this->structureMap, $this->structureDefinitionHierarchy);
         // Get the definition
         $dependencyDefinition = $parser->getDefinition($dependency, true);
         // Only classes and traits have invariants
         if ($fileEntry->getType() === 'class') {
             $classDefinition->setAncestralInvariants($dependencyDefinition->getInvariants(true));
         }
         // Finally add the dependency definition to our structure definition hierarchy to avoid
         // redundant parsing
         $this->structureDefinitionHierarchy->insert($dependencyDefinition);
     }
 }
 /**
  * Tests if the used structures are picked up correctly
  *
  * @return void
  */
 public function testUsedStructures()
 {
     $this->assertCount(2, $this->resultClass->getUsedStructures());
 }