/**
  * Recursively add super types
  *
  * @param array $superTypes
  * @param NodeType $superType
  * @return void
  */
 protected function addInheritedSuperTypes(array &$superTypes, NodeType $superType)
 {
     foreach ($superType->getDeclaredSuperTypes() as $inheritedSuperTypeName => $inheritedSuperType) {
         $this->addInheritedSuperTypes($superTypes, $inheritedSuperType);
         $superTypes[$inheritedSuperTypeName] = $inheritedSuperType;
     }
     // the method getSuperTypes() is a magic getter
     $superTypesInSuperType = $superType->getSuperTypes() ?: [];
     foreach ($superTypesInSuperType as $inheritedSuperTypeName => $inheritedSuperType) {
         if (!$inheritedSuperType) {
             unset($superTypes[$inheritedSuperTypeName]);
         }
     }
 }