8000 [FrameworkBundle] changed some default configs from canBeEnabled to c… · symfony/symfony@8a1caa9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8a1caa9

Browse files
committed
[FrameworkBundle] changed some default configs from canBeEnabled to canBeDisabled
1 parent 98ce21a commit 8a1caa9

File tree

3 files changed

+37
-6
lines changed

3 files changed

+37
-6
lines changed

src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ CHANGELOG
44
3.3.0
55
-----
66

7+
* Changed default configuration for
8+
assets/forms/validation/translation/serialization/csrf from `canBeEnabled()` to
9+
`canBeDisabled()` when Flex is used
710
* The server:* commands and their associated router files were moved to WebServerBundle
811
* Translation related services are not loaded anymore when the `framework.translator` option
912
is disabled.

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,16 @@
1212
namespace Symfony\Bundle\FrameworkBundle\DependencyInjection;
1313

1414
use Doctrine\Common\Annotations\Annotation;
15+
use Symfony\Bundle\FullStack;
16+
use Symfony\Component\Asset\Package;
1517
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
1618
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
1719
use Symfony\Component\Config\Definition\ConfigurationInterface;
20+
use Symfony\Component\Form\Form;
21+
use Symfony\Component\Security\Csrf\CsrfToken;
22+
use Symfony\Component\Serializer\Serializer;
23+
use Symfony\Component\Translation\Translator;
24+
use Symfony\Component\Validator\Validation;
1825

1926
/**
2027
* FrameworkExtension configuration structure.
@@ -127,7 +134,7 @@ private function addCsrfSection(ArrayNodeDefinition $rootNode)
127134
$rootNode
128135
->children()
129136
->arrayNode('csrf_protection')
130-
->canBeEnabled()
137+
->{!class_exists(FullStack::class) && class_exists(CsrfToken::class) ? 'canBeDisabled' : 'canBeEnabled'}()
131138
->end()
132139
->end()
133140
;
@@ -139,7 +146,7 @@ private function addFormSection(ArrayNodeDefinition $rootNode)
139146
->children()
140147
->arrayNode('form')
141148
->info('form configuration')
142-
->canBeEnabled()
149+
->{!class_exists(FullStack::class) && class_exists(Form::class) ? 'canBeDisabled' : 'canBeEnabled'}()
143150
->children()
144151
->arrayNode('csrf_protection')
145152
->treatFalseLike(array('enabled' => false))
@@ -506,7 +513,7 @@ private function addAssetsSection(ArrayNodeDefinition $rootNode)
506513
->children()
507514
->arrayNode('assets')
508515
->info('assets configuration')
509-
->canBeEnabled()
516+
->{!class_exists(FullStack::class) && class_exists(Package::class) ? 'canBeDisabled' : 'canBeEnabled'}()
510517
->fixXmlConfig('base_url')
511518
->children()
512519
->scalarNode('version_strategy')->defaultNull()->end()
@@ -573,7 +580,7 @@ private function addTranslatorSection(ArrayNodeDefinition $rootNode)
573580
->children()
574581
->arrayNode('translator')
575582
->info('translator configuration')
576-
->canBeEnabled()
583+
->{!class_exists(FullStack::class) && class_exists(Translator::class) ? 'canBeDisabled' : 'canBeEnabled'}()
577584
->fixXmlConfig('fallback')
578585
->fixXmlConfig('path')
579586
->children()
@@ -598,7 +605,7 @@ private function addValidationSection(ArrayNodeDefinition $rootNode)
598605
->children()
599606
->arrayNode('validation')
600607
->info('validation configuration')
601-
->canBeEnabled()
608+
->{!class_exists(FullStack::class) && class_exists(Validation::class) ? 'canBeDisabled' : 'canBeEnabled'}()
602609
->children()
603610
->scalarNode('cache')->end()
604611
->booleanNode('enable_annotations')->{class_exists(Annotation::class) ? 'defaultTrue' : 'defaultFalse'}()->end()
@@ -642,7 +649,7 @@ private function addSerializerSection(ArrayNodeDefinition $rootNode)
642649
->children()
643650
->arrayNode('serializer')
644651
->info('serializer configuration')
645-
->canBeEnabled()
652+
->{!class_exists(FullStack::class) && class_exists(Serializer::class) ? 'canBeDisabled' : 'canBeEnabled'}()
646653
->children()
647654
->booleanNode('enable_annotations')->{class_exists(Annotation::class) ? 'defaultTrue' : 'defaultFalse'}()->end()
648655
->scalarNode('cache')->end()

src/Symfony/Bundle/FullStack.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Bundle;
13+
14+
/**
15+
* A marker to be able to check if symfony/symfony is installed instead of the individual components/bundles.
16+
*
17+
* @internal
18+
*/
19+
final class FullStack
20+
{
21+
}

0 commit comments

Comments
 (0)
0