parameters:
  linker.substitutions:
    'phpDocumentor\Descriptor\ProjectDescriptor': ['files']
    'phpDocumentor\Descriptor\ApiSetDescriptor': ['files']
    'phpDocumentor\Descriptor\FileDescriptor':
      - 'tags'
      - 'classes'
      - 'interfaces'
      - 'traits'
      - 'functions'
      - 'constants'
    'phpDocumentor\Descriptor\ClassDescriptor':
      - 'tags'
      - 'parent'
      - 'interfaces'
      - 'constants'
      - 'properties'
      - 'methods'
      - 'usedTraits'
    'phpDocumentor\Descriptor\InterfaceDescriptor':
      - 'tags'
      - 'parent'
      - 'constants'
      - 'methods'
    'phpDocumentor\Descriptor\TraitDescriptor':
      - 'tags'
      - 'properties'
      - 'methods'
      - 'usedTraits'
    'phpDocumentor\Descriptor\EnumDescriptor':
      - 'tags'
      - 'interfaces'
      - 'cases'
      - 'methods'
      - 'usedTraits'
    'phpDocumentor\Descriptor\FunctionDescriptor':
      - 'tags'
      - 'arguments'
    'phpDocumentor\Descriptor\MethodDescriptor':
      - 'tags'
      - 'arguments'
    'phpDocumentor\Descriptor\ArgumentDescriptor':
      - 'type'
    'phpDocumentor\Descriptor\PropertyDescriptor':
      - 'tags'
      - 'type'
    'phpDocumentor\Descriptor\ConstantDescriptor':
      - 'tags'
      - 'type'
    'phpDocumentor\Descriptor\Tag\ParamDescriptor': ['type']
    'phpDocumentor\Descriptor\Tag\VarDescriptor': ['type']
    'phpDocumentor\Descriptor\Tag\ReturnDescriptor': ['type']
    'phpDocumentor\Descriptor\Tag\SeeDescriptor': ['reference']
    'phpDocumentor\Descriptor\Tag\UsesDescriptor': ['reference']
    'phpDocumentor\Descriptor\Tag\UsedByDescriptor': ['reference']

services:
  _defaults:
    autowire: true
    autoconfigure: true

  phpDocumentor\Compiler\:
    resource: '../src/phpDocumentor/Compiler'

  phpDocumentor\Pipeline\Stage\Configure:
    arguments:
      $currentWorkingDir: "@=service('application').getWorkingDir()"
    tags:
      - { name: 'phpdoc.pipeline.application.configuration', priority: 10000 }

  phpDocumentor\Parser\Cache\Locator: ~

  phpDocumentor\Pipeline\Stage\TransformToPayload:
    tags:
      - { name: 'phpdoc.pipeline.application.configuration', priority: 9000 }

  phpDocumentor\Pipeline\Stage\InitializeBuilderFromConfig:
    tags:
      - { name: 'phpdoc.pipeline.application.configuration', priority: 8000 }

  ###################################################################################
  ## Autoloading definitions for cache stages       #################################
  ###################################################################################

  phpDocumentor\Pipeline\Stage\Cache\PurgeCachesWhenForced:
    arguments:
      $filesCache: '@files'
      $descriptorsCache: '@descriptors'
    tags:
      - { name: 'phpdoc.pipeline.application.configuration', priority: 7000 }

  phpDocumentor\Pipeline\Stage\Cache\LoadProjectDescriptorFromCache:
    tags:
      - { name: 'phpdoc.pipeline.api_documentation.parse', priority: 2000 }
      - { name: 'phpdoc.pipeline.api_documentation.transform', priority: 6000 }

  phpDocumentor\Pipeline\Stage\Cache\StoreProjectDescriptorToCache:
    tags:
      - { name: 'phpdoc.pipeline.api_documentation.parse', priority: -1000 }

  ###################################################################################
  ## Autoloading definitions for parser stages      #################################
  ###################################################################################

  phpDocumentor\Pipeline\Stage\ParseApiDocumentationSets:
    arguments:
      $parseApiDocumentationSetPipeline: '@phpdoc.pipeline.parse_api_documentation_set'
    tags:
      - { name: 'phpdoc.pipeline.api_documentation.parse', priority: 3000 }

  phpDocumentor\Pipeline\Stage\Parser\CollectFiles:
    tags:
      - { name: 'phpdoc.pipeline.api_documentation.parse_api_documentation_set', priority: 4000 }

  phpDocumentor\Pipeline\Stage\Cache\GarbageCollectCache:
    tags:
      - { name: 'phpdoc.pipeline.api_documentation.parse_api_documentation_set', priority: 3000 }

  phpDocumentor\Pipeline\Stage\Parser\ParseFiles:
    tags:
      - { name: 'phpdoc.pipeline.api_documentation.parse_api_documentation_set', priority: 0 }


  ###################################################################################
  ## Autoloading definitions for compiler version stages    #########################
  ###################################################################################

  phpDocumentor\Compiler\Version\Pass\SetVersionPass:
    tags:
      - { name: 'phpdoc.pipeline.compile', priority: 10000 }

  phpdoc.pipeline.compile.stage.api_documentation:
    class: phpDocumentor\Pipeline\Stage\Compiler\DocumentationSetCompiler
    arguments:
      $compilerPipeline: '@phpdoc.pipeline.compile.api_documentation'
      $type: '\phpDocumentor\Descriptor\ApiSetDescriptor'
    tags:
      - { name: 'phpdoc.pipeline.compile', priority: 3000 }

  phpdoc.pipeline.compile.stage.guides:
    class: phpDocumentor\Pipeline\Stage\Compiler\DocumentationSetCompiler
    arguments:
      $compilerPipeline: '@phpdoc.pipeline.compile.guides'
      $type: '\phpDocumentor\Descriptor\GuideSetDescriptor'
    tags:
      - { name: 'phpdoc.pipeline.compile', priority: 2000 }

  phpDocumentor\Compiler\Version\Pass\TableOfContentsBuilder:
    tags:
      - { name: 'phpdoc.pipeline.compile', priority: 1000 }

  ###################################################################################
  ## Autoloading definitions for compiler stages    #################################
  ###################################################################################
  phpDocumentor\Compiler\ApiDocumentation\Linker\Linker:
    arguments: ['%linker.substitutions%']

  ###################################################################################
  ## Autoloading definitions for compiler guides stages     #########################
  ###################################################################################

  phpDocumentor\Compiler\Guides\Pass\GuidesCompiler:
    tags:
      - { name: 'phpdoc.pipeline.guides.compile', priority: 3000 }

  ###################################################################################
  ## Autoloading definitions for transform stages   #################################
  ###################################################################################

  phpDocumentor\Pipeline\Stage\Compile:
    arguments:
      $compilerPipeline: '@phpdoc.pipeline.compile'
    tags:
      - { name: 'phpdoc.pipeline.api_documentation.transform', priority: 5000 }

  phpDocumentor\Pipeline\Stage\Transform:
    tags:
      - { name: 'phpdoc.pipeline.api_documentation.transform', priority: 0 }
