This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/src/Symfony/Component/DependencyInjection
Fabien Potencier 226e2f3949 feature #27075 [DI][DX] Allow exclude to be an array of patterns (magnetik)
This PR was merged into the 4.2-dev branch.

Discussion
----------

[DI][DX] Allow exclude to be an array of patterns

| Q             | A
| ------------- | ---
| Branch?       | 4.2
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #23956
| License       | MIT

This is basically continuing #24428.

In YAML before:
```yaml
AppBundle\:
  resource: '../../src/AppBundle/*'
  exclude: '../../src/AppBundle/{Entity,Payload,Repository}'
```

in YAML after:

```yaml
AppBundle\:
  resource: '../../src/AppBundle/*'
  exclude:
    - '../../src/AppBundle/{Entity,Payload,Repository}'
    - '../../src/AppBundle/Event/*Event.php'
```

In XML before:
```xml
<prototype namespace="App\" resource="../src/*" exclude="../src/{Entity,Migrations,Tests}" />
```

in XML after:

```xml
<prototype namespace="App\" resource="../src/*">
  <exclude>../src/{Entity,Migrations,Tests}</exclude>
  <exclude>../src/Yolo</exclude>
</prototype>
```

In PHP before:
```php
$di->load(Prototype::class.'\\', '../Prototype')
        ->autoconfigure()
        ->exclude('../Prototype/{OtherDir,BadClasses}')
```

In PHP after:
```php
    $di->load(Prototype::class.'\\', '../Prototype')
        ->autoconfigure()
        ->exclude(['../Prototype/OtherDir', '../Prototype/BadClasses'])
```

Everything is backward compatible.
Maybe a decision about handling both attribute exclude and element exclude in XML should be taken.

Commits
-------

3ae3a03f41 [DI][DX] Allow exclude to be an array of patterns (taking #24428 over)
2018-05-09 18:25:25 +02:00
..
Argument Replace more docblocks by type-hints 2017-11-07 15:45:01 +01:00
Compiler [DI] Minor performance tweak in PriorityTaggedServiceTrait 2018-05-03 17:03:52 -07:00
Config fixed some deprecation messages 2017-12-31 06:50:45 +01:00
Dumper Merge branch '4.0' 2018-04-02 12:08:33 +02:00
Exception [DI][FrameworkBundle] Add PSR-11 "ContainerBag" to access parameters as-a-service 2017-12-04 09:41:54 +01:00
Extension [DI] Handle invalid bundle configuration class 2018-04-25 11:56:16 +02:00
LazyProxy removed version in @final @internal for version < 4.0 2018-02-19 13:18:43 +01:00
Loader [DI][DX] Allow exclude to be an array of patterns (taking #24428 over) 2018-05-09 18:00:53 +02:00
ParameterBag [DI] Validate env vars in config 2018-03-27 08:02:00 +02:00
Tests feature #27075 [DI][DX] Allow exclude to be an array of patterns (magnetik) 2018-05-09 18:25:25 +02:00
.gitignore Added missing files .gitignore 2013-07-21 14:12:18 +02:00
Alias.php Replace more docblocks by type-hints 2017-11-07 15:45:01 +01:00
CHANGELOG.md [DI] Handle invalid bundle configuration class 2018-04-25 11:56:16 +02:00
ChildDefinition.php Replace more docblocks by type-hints 2017-11-07 15:45:01 +01:00
composer.json updated version to 4.2 2018-05-07 16:51:25 +02:00
Container.php [DI][FrameworkBundle] Hide service ids that start with a dot 2018-04-20 15:14:43 +02:00
ContainerAwareInterface.php [DI] minor docblock fixes 2017-10-24 13:40:19 +02:00
ContainerAwareTrait.php [DI] minor docblock fixes 2017-10-24 13:40:19 +02:00
ContainerBuilder.php Merge branch '4.0' 2018-04-26 18:12:45 +02:00
ContainerInterface.php [DI] Add ContainerInterface::RUNTIME_EXCEPTION_ON_INVALID_REFERENCE 2018-03-24 17:54:13 +01:00
Definition.php feature #26627 [DI] Add runtime service exceptions to improve the error message when controller arguments cannot be injected (nicolas-grekas) 2018-03-28 20:04:39 +02:00
EnvVarProcessor.php Allow "json:" env var processor to parse null values 2018-03-19 19:53:10 +02:00
EnvVarProcessorInterface.php [DI] EnvVarProcessorInterface: fix missing use 2017-09-29 13:52:29 +02:00
ExpressionLanguage.php Merge branch '3.4' 2017-07-26 08:59:36 +02:00
ExpressionLanguageProvider.php [DI] Fix using private services in expressions 2017-07-25 13:50:49 +02:00
LICENSE fixed years in copyright 2018-01-03 08:23:28 +01:00
Parameter.php Replace more docblocks by type-hints 2017-11-07 15:45:01 +01:00
phpunit.xml.dist fail when detecting risky tests 2017-04-12 09:39:27 +02:00
README.md Updated all the README files 2016-03-04 08:12:06 +01:00
Reference.php fixed some deprecation messages 2017-12-31 06:12:25 +01:00
ResettableContainerInterface.php Implement resettable containers 2015-07-22 10:09:28 +02:00
ServiceLocator.php [DI] Add context to service-not-found exceptions thrown by service locators 2017-12-09 20:32:41 +01:00
ServiceSubscriberInterface.php [DI] Add and wire ServiceSubscriberInterface 2017-03-22 20:26:09 +01:00
TaggedContainerInterface.php remove api tags from code 2015-09-28 19:11:22 +02:00
TypedReference.php [DI] deprecate TypedReference::canBeAutoregistered() and getRequiringClass() 2018-03-22 15:55:20 +01:00
Variable.php Replace more docblocks by type-hints 2017-11-07 15:45:01 +01:00

DependencyInjection Component

The DependencyInjection component allows you to standardize and centralize the way objects are constructed in your application.

Resources