Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5981799

Browse filesBrowse files
committed
[FrameworkBundle] Use canBeEnabled() instead of canBeUnset() for consistency
1 parent 15b00cc commit 5981799
Copy full SHA for 5981799

File tree

3 files changed

+54
-12
lines changed
Filter options

3 files changed

+54
-12
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ private function addProfilerSection(ArrayNodeDefinition $rootNode)
204204
->booleanNode('only_master_requests')->defaultFalse()->end()
205205
->scalarNode('dsn')->defaultValue('file:%kernel.cache_dir%/profiler')->end()
206206
->arrayNode('matcher')
207-
->canBeUnset()
207+
->canBeEnabled()
208208
->performNoDeepMerging()
209209
->fixXmlConfig('ip')
210210
->children()
@@ -231,7 +231,7 @@ private function addRouterSection(ArrayNodeDefinition $rootNode)
231231
->children()
232232
->arrayNode('router')
233233
->info('router configuration')
234-
->canBeUnset()
234+
->canBeEnabled()
235235
->children()
236236
->scalarNode('resource')->isRequired()->end()
237237
->scalarNode('type')->end()
@@ -258,7 +258,7 @@ private function addSessionSection(ArrayNodeDefinition $rootNode)
258258
->children()
259259
->arrayNode('session')
260260
->info('session configuration')
261-
->canBeUnset()
261+
->canBeEnabled()
262262
->children()
263263
->scalarNode('storage_id')->defaultValue('session.storage.native')->end()
264264
->scalarNode('handler_id')->defaultValue('session.handler.native_file')->end()
@@ -289,7 +289,7 @@ private function addRequestSection(ArrayNodeDefinition $rootNode)
289289
->children()
290290
->arrayNode('request')
291291
->info('request configuration')
292-
->canBeUnset()
292+
->canBeEnabled()
293293
->fixXmlConfig('format')
294294
->children()
295295
->arrayNode('formats')
@@ -318,7 +318,7 @@ private function addTemplatingSection(ArrayNodeDefinition $rootNode)
318318
->children()
319319
->arrayNode('templating')
320320
->info('templating configuration')
321-
->canBeUnset()
321+
->canBeEnabled()
322322
->children()
323323
->scalarNode('hinclude_default_template')->defaultNull()->end()
324324
->scalarNode('cache')->end()
@@ -373,7 +373,7 @@ private function addAssetsSection(ArrayNodeDefinition $rootNode)
373373
->children()
374374
->arrayNode('assets')
375375
->info('assets configuration')
376-
->canBeUnset()
376+
->canBeEnabled()
377377
->fixXmlConfig('base_url')
378378
->children()
379379
->scalarNode('version_strategy')->defaultNull()->end()

‎src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,12 @@ public function load(array $configs, ContainerBuilder $container)
8383
$loader->load('test.xml');
8484
}
8585

86-
if (isset($config['session'])) {
86+
if ($config['session']['enabled']) {
8787
$this->sessionConfigEnabled = true;
8888
$this->registerSessionConfiguration($config['session'], $container, $loader);
8989
}
9090

91-
if (isset($config['request'])) {
91+
if ($config['request']['enabled']) {
9292
$this->registerRequestConfiguration($config['request'], $container, $loader);
9393
}
9494

@@ -104,11 +104,11 @@ public function load(array $configs, ContainerBuilder $container)
104104

105105
$this->registerSecurityCsrfConfiguration($config['csrf_protection'], $container, $loader);
106106

107-
if (isset($config['assets'])) {
107+
if ($config['assets']['enabled']) {
108108
$this->registerAssetsConfiguration($config['assets'], $container, $loader);
109109
}
110110

111-
if (isset($config['templating'])) {
111+
if ($config['templating']['enabled']) {
112112
$this->registerTemplatingConfiguration($config['templating'], $config['ide'], $container, $loader);
113113
}
114114

@@ -119,7 +119,7 @@ public function load(array $configs, ContainerBuilder $container)
119119
$this->registerTranslatorConfiguration($config['translator'], $container);
120120
$this->registerProfilerConfiguration($config['profiler'], $container, $loader);
121121

122-
if (isset($config['router'])) {
122+
if ($config['router']['enabled']) {
123123
$this->registerRouterConfiguration($config['router'], $container, $loader);
124124
}
125125

@@ -309,7 +309,7 @@ private function registerProfilerConfiguration(array $config, ContainerBuilder $
309309

310310
$container->setParameter('profiler.storage.dsn', $config['dsn']);
311311

312-
if (isset($config['matcher'])) {
312+
if ($config['matcher']['enabled']) {
313313
if (isset($config['matcher']['service'])) {
314314
$container->setAlias('profiler.request_matcher', $config['matcher']['service']);
315315
} elseif (isset($config['matcher']['ip']) || isset($config['matcher']['path']) || isset($config['matcher']['ips'])) {

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php
+42Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ public function testAssetsCanBeEnabled()
108108
$config = $processor->processConfiguration($configuration, array(array('assets' => null)));
109109

110110
$defaultConfig = array(
111+
'enabled' => true,
111112
'version_strategy' => null,
112113
'version' => null,
113114
'version_format' => '%%s?%%s',
@@ -193,6 +194,10 @@ protected static function getBundleDefaultConfig()
193194
'only_master_requests' => false,
194195
'dsn' => 'file:%kernel.cache_dir%/profiler',
195196
'collect' => true,
197+
'matcher' => array(
198+
'enabled' => false,
199+
'ips' => array(),
200+
)
196201
),
197202
'translator' => array(
198203
'enabled' => false,
@@ -223,6 +228,43 @@ protected static function getBundleDefaultConfig()
223228
'property_info' => array(
224229
'enabled' => false,
225230
),
231+
'router' => array(
232+
'enabled' => false,
233+
'http_port' => 80,
234+
'https_port' => 443,
235+
'strict_requirements' => true,
236+
),
237+
'session' => array(
238+
'enabled' => false,
239+
'storage_id' => 'session.storage.native',
240+
'handler_id' => 'session.handler.native_file',
241+
'cookie_httponly' => true,
242+
'gc_probability' => 1,
243+
'save_path' => '%kernel.cache_dir%/sessions',
244+
'metadata_update_threshold' => '0',
245+
),
246+
'request' => array(
247+
'enabled' => false,
248+
'formats' => array(),
249+
),
250+
'templating' => array(
251+
'enabled' => false,
252+
'hinclude_default_template' => null,
253+
'form' => array(
254+
'resources' => array('FrameworkBundle:Form')
255+
),
256+
'engines' => array(),
257+
'loaders' => array(),
258+
),
259+
'assets' => array(
260+
'enabled' => false,
261+
'version_strategy' => null,
262+
'version' => null,
263+
'version_format' => '%%s?%%s',
264+
'base_path' => '',
265+
'base_urls' => array(),
266+
'packages' => array(),
267+
),
226268
);
227269
}
228270
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.