bug #20749 [FrameworkBundle] Smarter default for framework.annotations (ogizanagi)

This PR was merged into the 3.2 branch.

Discussion
----------

[FrameworkBundle] Smarter default for framework.annotations

| Q             | A
| ------------- | ---
| Branch?       | 3.2
| Bug fix?      | yesish (could be considered as a minor BC break)
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | N/A
| License       | MIT
| Doc PR        | N/A

`framework.annotations` default should be true only if `doctrine/annotations` is installed.

Indeed, in https://github.com/symfony/symfony/pull/20097, the dependency on `doctrine/annotations` was removed from the framework bundle.
Thus, an application can break (not talking from one actually relying on annotations) as soon as it uses the framework bundle without the `framework.annotations` key explicitly set to `false` (I had the case in a fixture application in the testsuite of a package).

Commits
-------

e38be09 [FrameworkBundle] framework.annotations default should be true only if doctrine/annotations is installed
This commit is contained in:
Fabien Potencier 2016-12-14 09:14:24 +01:00
commit 8de22de869

View File

@ -11,6 +11,7 @@
namespace Symfony\Bundle\FrameworkBundle\DependencyInjection;
use Doctrine\Common\Annotations\Annotation;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
@ -602,7 +603,7 @@ class Configuration implements ConfigurationInterface
->children()
->arrayNode('annotations')
->info('annotation configuration')
->canBeDisabled()
->{class_exists(Annotation::class) ? 'canBeDisabled' : 'canBeEnabled'}()
->children()
->scalarNode('cache')->defaultValue('php_array')->end()
->scalarNode('file_cache_dir')->defaultValue('%kernel.cache_dir%/annotations')->end()