Q:

Symfony 4 autowiring exclude ignores subfolders

Assume following directory structure:
/src
  /DTO
    /Factory
      /Collection

I want to exclude all classes, including classes from subdirectories of /DTO directory
In my services file I do:
services:
  _defaults:
    autowire: true
    autoconfigure: true
    public: false

    App\:
    resource: '../src/*
    exclude:
      - '../src/DTO/*'

This leads to:
Symfony\Component\DependencyInjection\Exception\RuntimeException : Cannot autowire service App\DTO\Factory\Collection\MyCollection

If this service placed in DTO folder directly - then autowiring works.
Can I specify the exclude expression in any way to include subfolders?

A:

To exclude everything from DTO folder use:
    App\:
      resource: '../src/*'
      exclude:
        - '../src/DTO'

i.e. w/o * symbol

