Q: Is it possible to exclude multiple directories when using Symfony autowire? When using autowire in Symfony 4 I used this working code:
App\:
    resource: '../src/*'
    exclude: '../src/{Domain,Entity,Migrations,Tests}'

That code excludes from the autowiring all this folders: 
- src/Domain
- src/Entity
- src/Migrations
- src/Tests

That is ok, but the problem comes when I want to exclude multiple folders with the same name that are dispersed inside another folders. 
For example if we have this structure:


*

*src/Folder1/FolderToExclude

*src/Folder2/Folder2-1/FolderToExclude


¿Is there some way to exclude all folders with name FolderToExclude?
I already tried the following code with some small variations:
App\:
    resource: '../src/*'
    exclude: '../src/{Domain,Entity,Migrations,Tests,**/FolderToExclude}'

But it does not work :(

A: In Symfony 4.1. But there is an closed bug and a pull request that may make this feature available for symfony 4.2 ! 

A: Excluding some directories bring some gain et efficiency for the service container initialization and service autoload processing ... 
But, some others important features are also possible through that 'exclude' service configuration option : 


*

*IMHO, a very good motive of the 'exclude' option, permit also to manage PSR-4 autoloading conflict with internal bundles (under the src/ directory). 

*Excluding sub-directory block is the safe way to protect internal bundles namespace in the SF4 application. This also protect against autoloading conflicts between internal bundles and App bundle less part of SF4.

*In your case, it's better to manually specify the path of each FolderToExclude, checking that there is no cross boundary with App subfolders.

*If the number of sub-directories to exclude is too large for you to enumerate them individually, them you will surely have code design/organization problems to resolve at first.  


Hope this help for your design decision.
