From 0656284f7fe49418f3417d9f2a996be8ee540603 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 2 May 2017 21:00:06 +0200 Subject: [PATCH] [DI] Defaults to public=false in all service config files --- .../DebugBundle/Resources/config/services.xml | 15 +-- src/Symfony/Bundle/DebugBundle/composer.json | 4 +- .../Resources/config/annotations.xml | 16 +-- .../Resources/config/assets.xml | 20 ++-- .../Resources/config/cache.xml | 28 ++--- .../Resources/config/cache_debug.xml | 2 + .../Resources/config/collectors.xml | 20 ++-- .../Resources/config/console.xml | 4 +- .../Resources/config/debug.xml | 8 +- .../Resources/config/debug_prod.xml | 12 +- .../FrameworkBundle/Resources/config/esi.xml | 6 +- .../FrameworkBundle/Resources/config/form.xml | 106 +++++++++--------- .../Resources/config/form_csrf.xml | 7 +- .../Resources/config/form_debug.xml | 10 +- .../Resources/config/fragment_listener.xml | 4 +- .../Resources/config/fragment_renderer.xml | 12 +- .../Resources/config/identity_translator.xml | 8 +- .../Resources/config/profiling.xml | 8 +- .../Resources/config/property_access.xml | 6 +- .../Resources/config/property_info.xml | 8 +- .../Resources/config/request.xml | 4 +- .../Resources/config/routing.xml | 36 +++--- .../Resources/config/security_csrf.xml | 14 ++- .../Resources/config/serializer.xml | 42 +++---- .../Resources/config/services.xml | 41 +++---- .../Resources/config/session.xml | 32 +++--- .../FrameworkBundle/Resources/config/ssi.xml | 6 +- .../Resources/config/templating.xml | 22 ++-- .../Resources/config/templating_debug.xml | 4 +- .../Resources/config/templating_php.xml | 30 ++--- .../FrameworkBundle/Resources/config/test.xml | 10 +- .../Resources/config/translation.xml | 62 +++++----- .../Resources/config/translation_debug.xml | 6 +- .../Resources/config/validator.xml | 22 ++-- .../FrameworkBundle/Resources/config/web.xml | 30 ++--- .../Resources/config/web_link.xml | 4 +- .../Resources/config/workflow.xml | 18 +-- .../Bundle/FrameworkBundle/composer.json | 2 +- .../Resources/config/collectors.xml | 4 +- .../Resources/config/console.xml | 4 +- .../SecurityBundle/Resources/config/guard.xml | 5 +- .../Resources/config/security.xml | 74 ++++++------ .../Resources/config/security_acl.xml | 12 +- .../Resources/config/security_acl_dbal.xml | 18 +-- .../Resources/config/security_debug.xml | 4 +- .../Resources/config/security_listeners.xml | 68 +++++------ .../Resources/config/security_rememberme.xml | 15 ++- .../Resources/config/templating_php.xml | 6 +- .../Resources/config/templating_twig.xml | 6 +- .../Bundle/SecurityBundle/composer.json | 2 +- .../TwigBundle/Resources/config/form.xml | 8 +- .../Resources/config/templating.xml | 6 +- .../TwigBundle/Resources/config/twig.xml | 58 +++++----- .../Resources/config/profiler.xml | 14 ++- .../Resources/config/toolbar.xml | 4 +- .../Bundle/WebProfilerBundle/composer.json | 3 +- .../Resources/config/webserver.xml | 11 +- .../ResolveDefinitionTemplatesPass.php | 2 +- .../Loader/XmlFileLoader.php | 29 +++-- .../Loader/YamlFileLoader.php | 13 ++- .../Tests/Compiler/IntegrationTest.php | 6 + .../xml/{services29.xml => services28.xml} | 5 +- .../defaults_child_tags/expected.yml | 8 ++ .../integration/defaults_child_tags/main.yml | 18 +++ .../Tests/Fixtures/yaml/services28.yml | 5 + .../Tests/Loader/XmlFileLoaderTest.php | 22 +++- .../Tests/Loader/YamlFileLoaderTest.php | 8 +- 67 files changed, 649 insertions(+), 478 deletions(-) rename src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/{services29.xml => services28.xml} (77%) create mode 100644 src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/integration/defaults_child_tags/expected.yml create mode 100644 src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/integration/defaults_child_tags/main.yml diff --git a/src/Symfony/Bundle/DebugBundle/Resources/config/services.xml b/src/Symfony/Bundle/DebugBundle/Resources/config/services.xml index ae7d91add15d..79460a160259 100644 --- a/src/Symfony/Bundle/DebugBundle/Resources/config/services.xml +++ b/src/Symfony/Bundle/DebugBundle/Resources/config/services.xml @@ -5,13 +5,15 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - + + + - + @@ -20,19 +22,19 @@ null - + - - + + null %kernel.charset% 0 - + null %kernel.charset% 0 @@ -43,5 +45,4 @@ - diff --git a/src/Symfony/Bundle/DebugBundle/composer.json b/src/Symfony/Bundle/DebugBundle/composer.json index d6d7d0b33b16..7bf23af8d6ad 100644 --- a/src/Symfony/Bundle/DebugBundle/composer.json +++ b/src/Symfony/Bundle/DebugBundle/composer.json @@ -22,8 +22,8 @@ "symfony/var-dumper": "~2.8|~3.0" }, "require-dev": { - "symfony/config": "~2.8|~3.0", - "symfony/dependency-injection": "~2.8|~3.0", + "symfony/config": "~3.3", + "symfony/dependency-injection": "~3.3", "symfony/web-profiler-bundle": "~2.8|~3.0" }, "suggest": { diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/annotations.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/annotations.xml index f3f4e0bd6114..15bf00295419 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/annotations.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/annotations.xml @@ -5,7 +5,9 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - + + + required @@ -18,9 +20,8 @@ - - + @@ -28,17 +29,17 @@ - + - + %kernel.cache_dir%/annotations.php - + @@ -48,6 +49,7 @@ - + + diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/assets.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/assets.xml index e83afa7cf414..e714e2834c5f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/assets.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/assets.xml @@ -5,43 +5,43 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> + - + - + - + - + - + - + - + - + - + - diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/cache.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/cache.xml index 72eca553f58a..e0d5788bc487 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/cache.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/cache.xml @@ -5,12 +5,13 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> + - + - + @@ -26,7 +27,7 @@ - + @@ -37,7 +38,7 @@ - + @@ -48,7 +49,7 @@ - + @@ -59,7 +60,7 @@ - + @@ -70,14 +71,14 @@ - + 0 - + @@ -88,7 +89,7 @@ - + @@ -99,13 +100,12 @@ - + - - - - + + + diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/cache_debug.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/cache_debug.xml index 3d68472028e9..9356d66769c1 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/cache_debug.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/cache_debug.xml @@ -5,6 +5,8 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> + + diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/collectors.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/collectors.xml index 340c7e197280..8cd0c3ced0d8 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/collectors.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/collectors.xml @@ -5,47 +5,49 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - + + + - + - + - + - + - + %kernel.cache_dir%/%kernel.container_class% - + - + - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/console.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/console.xml index 350c2e20ef7a..3d9bd1b2489c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/console.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/console.xml @@ -5,12 +5,12 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> + - + - diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/debug.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/debug.xml index 3d260e4aff72..58a086b2129b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/debug.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/debug.xml @@ -9,20 +9,22 @@ - + + + - + - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/debug_prod.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/debug_prod.xml index 76c143b74e93..60635b3c000b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/debug_prod.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/debug_prod.xml @@ -9,7 +9,9 @@ - + + + null @@ -21,12 +23,12 @@ true - - + + - + %debug.file_link_format% - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/esi.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/esi.xml index 86600a869856..8925acb1ac8f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/esi.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/esi.xml @@ -5,9 +5,11 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - + - + + + diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/form.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/form.xml index a9eb59b4782a..642d8d4ee7bf 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/form.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/form.xml @@ -5,12 +5,14 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> + + - - + + - + - + - + - + @@ -40,156 +42,156 @@ - + - + - + - + - + - + - + - + The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - + The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - + - + The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - + The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - + The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - + The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - + The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - + The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - + The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - + The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - + The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - + The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - + The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - + The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - + The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - + The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - + The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - + The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - + The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - + The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - + The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - + The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - + The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - + The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - + The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - + The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - + The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - + The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - + The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. - + - + - + - + - + - + - + %validator.translation_domain% - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/form_csrf.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/form_csrf.xml index e4363184b95e..5beec83ccce0 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/form_csrf.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/form_csrf.xml @@ -5,7 +5,9 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - + + + %form.type_extension.csrf.enabled% @@ -15,12 +17,11 @@ - + The service "%service_id%" is internal and deprecated since Symfony 3.3 and will be removed in Symfony 4.0 - diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/form_debug.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/form_debug.xml index 00e7c34e5e10..d7e4803f5cf5 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/form_debug.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/form_debug.xml @@ -5,7 +5,9 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - + + + @@ -13,15 +15,15 @@ - + - + - + false diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/fragment_listener.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/fragment_listener.xml index 332e767c4daf..a9628ad5609e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/fragment_listener.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/fragment_listener.xml @@ -5,7 +5,9 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - + + + %fragment.path% diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/fragment_renderer.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/fragment_renderer.xml index 963179c64e99..a24d2880ea82 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/fragment_renderer.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/fragment_renderer.xml @@ -10,27 +10,29 @@ - + + + %kernel.debug% - + %fragment.path% - + %fragment.renderer.hinclude.global_template% %fragment.path% - + @@ -38,7 +40,7 @@ %fragment.path% - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/identity_translator.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/identity_translator.xml index 542d6248db4d..def3c1d2c654 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/identity_translator.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/identity_translator.xml @@ -4,11 +4,13 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - + + + - + - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/profiling.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/profiling.xml index fdfd8e0e9a0d..c409e981de7b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/profiling.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/profiling.xml @@ -5,17 +5,19 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - + + + - + %profiler.storage.dsn% - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/property_access.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/property_access.xml index af81e9dd0658..15e684b62ae2 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/property_access.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/property_access.xml @@ -5,11 +5,13 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - + + + - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/property_info.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/property_info.xml index 81e1037052b2..8e0498e4f68b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/property_info.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/property_info.xml @@ -5,16 +5,18 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - + + + - + - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/request.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/request.xml index 323744edaa42..b9e9e9c7e058 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/request.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/request.xml @@ -5,7 +5,9 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - + + + diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/routing.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/routing.xml index 0befbe91c2a7..1278a0cb2208 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/routing.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/routing.xml @@ -19,44 +19,46 @@ - + - + + + - + - + - + - + - + - + - + %router.resource% @@ -79,12 +81,12 @@ - - - - + + + + - + %router.request_context.base_url% GET %router.request_context.host% @@ -92,14 +94,14 @@ %request_listener.http_port% %request_listener.https_port% - + - + - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/security_csrf.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/security_csrf.xml index 489028d3f7b2..7a7fa2a38a03 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/security_csrf.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/security_csrf.xml @@ -5,18 +5,20 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - - + - + + + + - + - + - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/serializer.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/serializer.xml index 518164cf8a89..d350091a0182 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/serializer.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/serializer.xml @@ -10,20 +10,22 @@ - + + + - - - - - + + + + + - + - + null @@ -32,63 +34,63 @@ - + - + - + - + null - + %serializer.mapping.cache.file% - + %serializer.mapping.cache.file% - + %serializer.mapping.cache.prefix% The "%service_id%" service is deprecated since Symfony 3.2 and will be removed in 4.0. APCu should now be automatically used when available. - + The "%service_id%" service is deprecated since Symfony 3.1 and will be removed in 4.0. APCu should now be automatically used when available. - + - + - + - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/services.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/services.xml index 86e3f597a1d2..7c935a6bd019 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/services.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/services.xml @@ -5,27 +5,29 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - + + + - + - + - + - - + + - + - + Symfony\Component\HttpFoundation\ParameterBag Symfony\Component\HttpFoundation\HeaderBag @@ -37,41 +39,40 @@ The "%service_id%" option is deprecated since version 3.3, to be removed in 4.0. - + - - + + - - + + - + %kernel.root_dir%/Resources %kernel.root_dir% - + - + %kernel.secret% - + - + - + - diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/session.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/session.xml index 55180b602722..2a930075bbf5 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/session.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/session.xml @@ -9,49 +9,51 @@ - + + + - - - + + + - + %session.metadata.storage_key% %session.metadata.update_threshold% - + %session.storage.options% - + - + - + - + %kernel.cache_dir%/sessions MOCKSESSID - + %session.save_path% - + - + @@ -63,11 +65,11 @@ - + - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/ssi.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/ssi.xml index fe320e9812eb..4df799fcf5fe 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/ssi.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/ssi.xml @@ -5,9 +5,11 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - + - + + + diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/templating.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/templating.xml index d4d0053c4e4b..1de55085c84f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/templating.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/templating.xml @@ -5,46 +5,48 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - + + + - + - + - + %kernel.cache_dir% - + %kernel.root_dir%/Resources - + - + - + %templating.loader.cache.path% - + - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/templating_debug.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/templating_debug.xml index f2bdc45c2293..cc478a03eb34 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/templating_debug.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/templating_debug.xml @@ -5,7 +5,9 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - + + + diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/templating_php.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/templating_php.xml index 5383e39fee88..09a00c78e44a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/templating_php.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/templating_php.xml @@ -5,7 +5,9 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - + + + @@ -13,68 +15,68 @@ %kernel.charset% - + - + - + - + - + - + - + %kernel.root_dir% %kernel.charset% - + - + - + - + %templating.helper.form.resources% - + - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/test.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/test.xml index 719c84aa1039..2b75d4c5b701 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/test.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/test.xml @@ -9,18 +9,20 @@ - + + + %test.client.parameters% - + - + - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/translation.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/translation.xml index 2fa53885b9d8..ab1f9223a5b8 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/translation.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/translation.xml @@ -5,7 +5,9 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - + + + %kernel.default_locale% @@ -18,114 +20,114 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/translation_debug.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/translation_debug.xml index fc7d2faaa9e8..ba30db65dcb8 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/translation_debug.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/translation_debug.xml @@ -5,13 +5,15 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> + + - + - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.xml index 2fb73fa39bbd..f895eb4cc0bd 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.xml @@ -10,12 +10,14 @@ - + + + - + - + @@ -28,16 +30,16 @@ - + - + %validator.mapping.cache.file% - + @@ -47,7 +49,7 @@ - + @@ -57,15 +59,15 @@ - + - + - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/web.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/web.xml index 9bc44418cf52..0203bf048bc2 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/web.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/web.xml @@ -5,67 +5,69 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - + + + - + - + - + - + - + - + - + - + - + - + %kernel.charset% - + - + %kernel.default_locale% - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/web_link.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/web_link.xml index b80708defed1..6ce82082a3ca 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/web_link.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/web_link.xml @@ -5,10 +5,10 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> + - + - diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/workflow.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/workflow.xml index 0e79543ac643..de45efb12fcd 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/workflow.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/workflow.xml @@ -5,30 +5,32 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - + + + null - + null - - + + - - + + - + - + diff --git a/src/Symfony/Bundle/FrameworkBundle/composer.json b/src/Symfony/Bundle/FrameworkBundle/composer.json index d613ecbc01f8..b00987433c56 100644 --- a/src/Symfony/Bundle/FrameworkBundle/composer.json +++ b/src/Symfony/Bundle/FrameworkBundle/composer.json @@ -19,7 +19,7 @@ "php": ">=5.5.9", "symfony/cache": "~3.3", "symfony/class-loader": "~3.2", - "symfony/dependency-injection": "~3.3", + "symfony/dependency-injection": "~3.3-beta2", "symfony/config": "~3.3", "symfony/event-dispatcher": "~3.3", "symfony/http-foundation": "~3.3", diff --git a/src/Symfony/Bundle/SecurityBundle/Resources/config/collectors.xml b/src/Symfony/Bundle/SecurityBundle/Resources/config/collectors.xml index f812a9d790bb..50ee3bba2b89 100644 --- a/src/Symfony/Bundle/SecurityBundle/Resources/config/collectors.xml +++ b/src/Symfony/Bundle/SecurityBundle/Resources/config/collectors.xml @@ -5,7 +5,9 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - + + + diff --git a/src/Symfony/Bundle/SecurityBundle/Resources/config/console.xml b/src/Symfony/Bundle/SecurityBundle/Resources/config/console.xml index 12d8e13c67b4..d8b818ff6105 100644 --- a/src/Symfony/Bundle/SecurityBundle/Resources/config/console.xml +++ b/src/Symfony/Bundle/SecurityBundle/Resources/config/console.xml @@ -5,7 +5,9 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - + + + diff --git a/src/Symfony/Bundle/SecurityBundle/Resources/config/guard.xml b/src/Symfony/Bundle/SecurityBundle/Resources/config/guard.xml index 80318c243a97..77a09f24f8a9 100644 --- a/src/Symfony/Bundle/SecurityBundle/Resources/config/guard.xml +++ b/src/Symfony/Bundle/SecurityBundle/Resources/config/guard.xml @@ -5,8 +5,11 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> + + @@ -16,7 +19,6 @@ @@ -26,7 +28,6 @@ diff --git a/src/Symfony/Bundle/SecurityBundle/Resources/config/security.xml b/src/Symfony/Bundle/SecurityBundle/Resources/config/security.xml index 9ec300851df8..9daab01ac4d8 100644 --- a/src/Symfony/Bundle/SecurityBundle/Resources/config/security.xml +++ b/src/Symfony/Bundle/SecurityBundle/Resources/config/security.xml @@ -11,24 +11,26 @@ - + + + %security.access.always_authenticate_before_granting% - + - - + + - + - + %security.authentication.manager.erase_credentials% @@ -36,64 +38,64 @@ - + %security.authentication.trust_resolver.anonymous_class% %security.authentication.trust_resolver.rememberme_class% - + %security.authentication.session_strategy.strategy% - + - - + + - + - - + + - + - + - + - + - + - + %security.role_hierarchy.roles% - + - + - + - + @@ -102,26 +104,26 @@ - + - + - + - + - + @@ -135,17 +137,17 @@ - + - - + + - + @@ -156,16 +158,16 @@ - + - + - + diff --git a/src/Symfony/Bundle/SecurityBundle/Resources/config/security_acl.xml b/src/Symfony/Bundle/SecurityBundle/Resources/config/security_acl.xml index 982a6619a254..68418dadff1c 100644 --- a/src/Symfony/Bundle/SecurityBundle/Resources/config/security_acl.xml +++ b/src/Symfony/Bundle/SecurityBundle/Resources/config/security_acl.xml @@ -5,22 +5,24 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - + - + + + - + - + - + diff --git a/src/Symfony/Bundle/SecurityBundle/Resources/config/security_acl_dbal.xml b/src/Symfony/Bundle/SecurityBundle/Resources/config/security_acl_dbal.xml index b8660b4bc554..1399be3c12bd 100644 --- a/src/Symfony/Bundle/SecurityBundle/Resources/config/security_acl_dbal.xml +++ b/src/Symfony/Bundle/SecurityBundle/Resources/config/security_acl_dbal.xml @@ -5,9 +5,11 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - + - + + + @@ -20,7 +22,7 @@ - + %security.acl.dbal.class_table_name% %security.acl.dbal.entry_table_name% @@ -30,18 +32,18 @@ - + - - + + - + - + diff --git a/src/Symfony/Bundle/SecurityBundle/Resources/config/security_debug.xml b/src/Symfony/Bundle/SecurityBundle/Resources/config/security_debug.xml index e03f578784a3..f836925ef8fd 100644 --- a/src/Symfony/Bundle/SecurityBundle/Resources/config/security_debug.xml +++ b/src/Symfony/Bundle/SecurityBundle/Resources/config/security_debug.xml @@ -5,7 +5,9 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - + + + diff --git a/src/Symfony/Bundle/SecurityBundle/Resources/config/security_listeners.xml b/src/Symfony/Bundle/SecurityBundle/Resources/config/security_listeners.xml index 45ebde81f132..ab9a587ad7d1 100644 --- a/src/Symfony/Bundle/SecurityBundle/Resources/config/security_listeners.xml +++ b/src/Symfony/Bundle/SecurityBundle/Resources/config/security_listeners.xml @@ -5,7 +5,9 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - + + + @@ -13,29 +15,29 @@ - + - + %request_listener.http_port% %request_listener.https_port% - + - + - + - + - + @@ -45,27 +47,27 @@ - + - + - + - + / - + - + @@ -79,23 +81,23 @@ - + - + - + - + @@ -106,15 +108,17 @@ - + @@ -122,7 +126,7 @@ - + @@ -132,7 +136,7 @@ - + @@ -143,7 +147,7 @@ - + @@ -157,7 +161,7 @@ - + @@ -167,7 +171,7 @@ - + @@ -176,7 +180,7 @@ - + @@ -185,7 +189,7 @@ - + @@ -193,7 +197,7 @@ %security.authentication.hide_user_not_found% - + @@ -202,18 +206,18 @@ %security.authentication.hide_user_not_found% - + - + - + @@ -226,7 +230,7 @@ false - + @@ -239,7 +243,7 @@ - + diff --git a/src/Symfony/Bundle/SecurityBundle/Resources/config/security_rememberme.xml b/src/Symfony/Bundle/SecurityBundle/Resources/config/security_rememberme.xml index 7c67e8f5db8c..1f0e28868760 100644 --- a/src/Symfony/Bundle/SecurityBundle/Resources/config/security_rememberme.xml +++ b/src/Symfony/Bundle/SecurityBundle/Resources/config/security_rememberme.xml @@ -5,7 +5,9 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - + + + @@ -16,13 +18,13 @@ - + - + - + @@ -34,16 +36,17 @@ - + - diff --git a/src/Symfony/Bundle/SecurityBundle/Resources/config/templating_php.xml b/src/Symfony/Bundle/SecurityBundle/Resources/config/templating_php.xml index e800500d43a5..b0676e2fc15b 100644 --- a/src/Symfony/Bundle/SecurityBundle/Resources/config/templating_php.xml +++ b/src/Symfony/Bundle/SecurityBundle/Resources/config/templating_php.xml @@ -5,12 +5,14 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - + + + - + diff --git a/src/Symfony/Bundle/SecurityBundle/Resources/config/templating_twig.xml b/src/Symfony/Bundle/SecurityBundle/Resources/config/templating_twig.xml index 85be5476d4fa..a575ca2fa768 100644 --- a/src/Symfony/Bundle/SecurityBundle/Resources/config/templating_twig.xml +++ b/src/Symfony/Bundle/SecurityBundle/Resources/config/templating_twig.xml @@ -5,12 +5,14 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - + + + - + diff --git a/src/Symfony/Bundle/SecurityBundle/composer.json b/src/Symfony/Bundle/SecurityBundle/composer.json index 841fc3ea5d6b..df6049b05996 100644 --- a/src/Symfony/Bundle/SecurityBundle/composer.json +++ b/src/Symfony/Bundle/SecurityBundle/composer.json @@ -18,7 +18,7 @@ "require": { "php": ">=5.5.9", "symfony/security": "~3.3", - "symfony/dependency-injection": "~3.3", + "symfony/dependency-injection": "~3.3-beta2", "symfony/http-kernel": "~3.3", "symfony/polyfill-php70": "~1.0" }, diff --git a/src/Symfony/Bundle/TwigBundle/Resources/config/form.xml b/src/Symfony/Bundle/TwigBundle/Resources/config/form.xml index f1603c15461b..3b0b147c4ba5 100644 --- a/src/Symfony/Bundle/TwigBundle/Resources/config/form.xml +++ b/src/Symfony/Bundle/TwigBundle/Resources/config/form.xml @@ -4,19 +4,21 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - + + + twig.form.renderer - + %twig.form.resources% - + diff --git a/src/Symfony/Bundle/TwigBundle/Resources/config/templating.xml b/src/Symfony/Bundle/TwigBundle/Resources/config/templating.xml index b9c1806221ed..26d7d6c9c14a 100644 --- a/src/Symfony/Bundle/TwigBundle/Resources/config/templating.xml +++ b/src/Symfony/Bundle/TwigBundle/Resources/config/templating.xml @@ -4,14 +4,16 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - + + + %kernel.project_dir% - + diff --git a/src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml b/src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml index 22ad287f7011..63c7462cec3e 100644 --- a/src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml +++ b/src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml @@ -5,7 +5,9 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - + + + @@ -17,16 +19,16 @@ - + - + %kernel.environment% %kernel.debug% - + @@ -34,103 +36,103 @@ - + %kernel.root_dir% - + - + %kernel.project_dir% - + - + - + - + - + - + - + %kernel.root_dir% %kernel.charset% - + - + - + %kernel.debug% - + - + - + - + - + - + - + %twig.exception_listener.controller% - + %kernel.debug% - + %twig.exception_listener.controller% - + @@ -139,7 +141,7 @@ - + diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/config/profiler.xml b/src/Symfony/Bundle/WebProfilerBundle/Resources/config/profiler.xml index 931363ac6d32..4c659b628144 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/config/profiler.xml +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/config/profiler.xml @@ -5,7 +5,9 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - + + + @@ -15,25 +17,25 @@ null - + - + %kernel.debug% - + - + @@ -50,7 +52,7 @@ - + %debug.file_link_format% null diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/config/toolbar.xml b/src/Symfony/Bundle/WebProfilerBundle/Resources/config/toolbar.xml index 3f19d22c8136..25f49fc2cd06 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/config/toolbar.xml +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/config/toolbar.xml @@ -5,7 +5,9 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - + + + %web_profiler.debug_toolbar.intercept_redirects% diff --git a/src/Symfony/Bundle/WebProfilerBundle/composer.json b/src/Symfony/Bundle/WebProfilerBundle/composer.json index 22ad5c074cf3..276f8f68cc4e 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/composer.json +++ b/src/Symfony/Bundle/WebProfilerBundle/composer.json @@ -27,10 +27,11 @@ "require-dev": { "symfony/config": "~2.8|~3.0", "symfony/console": "~2.8|~3.0", - "symfony/dependency-injection": "~2.8|~3.0", + "symfony/dependency-injection": "~3.3", "symfony/stopwatch": "~2.8|~3.0" }, "conflict": { + "symfony/dependency-injection": "<3.3", "symfony/event-dispatcher": "<3.2", "symfony/var-dumper": "<3.3" }, diff --git a/src/Symfony/Bundle/WebServerBundle/Resources/config/webserver.xml b/src/Symfony/Bundle/WebServerBundle/Resources/config/webserver.xml index aab41fe51a84..1242bb07d6d1 100644 --- a/src/Symfony/Bundle/WebServerBundle/Resources/config/webserver.xml +++ b/src/Symfony/Bundle/WebServerBundle/Resources/config/webserver.xml @@ -5,25 +5,26 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - + + + %kernel.root_dir%/../web %kernel.environment% - + %kernel.root_dir%/../web %kernel.environment% - + - + - diff --git a/src/Symfony/Component/DependencyInjection/Compiler/ResolveDefinitionTemplatesPass.php b/src/Symfony/Component/DependencyInjection/Compiler/ResolveDefinitionTemplatesPass.php index f4f8cd5c151c..dfceb6a92083 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/ResolveDefinitionTemplatesPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/ResolveDefinitionTemplatesPass.php @@ -84,7 +84,7 @@ private function doResolveDefinition(ChildDefinition $definition) $def = new Definition(); // merge in parent definition - // purposely ignored attributes: abstract, shared, tags + // purposely ignored attributes: abstract, shared, tags, autoconfigured $def->setClass($parentDef->getClass()); $def->setArguments($parentDef->getArguments()); $def->setMethodCalls($parentDef->getMethodCalls()); diff --git a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php index 79a0b1213d4c..3ccbdbc79155 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php @@ -43,8 +43,10 @@ public function load($resource, $type = null) $this->container->fileExists($path); + $defaults = $this->getServiceDefaults($xml, $path); + // anonymous services - $this->processAnonymousServices($xml, $path); + $this->processAnonymousServices($xml, $path, $defaults); // imports $this->parseImports($xml, $path); @@ -57,7 +59,7 @@ public function load($resource, $type = null) // services try { - $this->parseDefinitions($xml, $path); + $this->parseDefinitions($xml, $path, $defaults); } finally { $this->instanceof = array(); } @@ -120,7 +122,7 @@ private function parseImports(\DOMDocument $xml, $file) * @param \DOMDocument $xml * @param string $file */ - private function parseDefinitions(\DOMDocument $xml, $file) + private function parseDefinitions(\DOMDocument $xml, $file, $defaults) { $xpath = new \DOMXPath($xml); $xpath->registerNamespace('container', self::NS); @@ -138,7 +140,6 @@ private function parseDefinitions(\DOMDocument $xml, $file) } $this->isLoadingInstanceof = false; - $defaults = $this->getServiceDefaults($xml, $file); foreach ($services as $service) { if (null !== $definition = $this->parseDefinition($service, $file, $defaults)) { if ('prototype' === $service->tagName) { @@ -194,7 +195,7 @@ private function getServiceDefaults(\DOMDocument $xml, $file) * * @return Definition|null */ - private function parseDefinition(\DOMElement $service, $file, array $defaults = array()) + private function parseDefinition(\DOMElement $service, $file, array $defaults) { if ($alias = $service->getAttribute('alias')) { $this->validateAlias($service, $file); @@ -214,11 +215,18 @@ private function parseDefinition(\DOMElement $service, $file, array $defaults = $definition = new ChildDefinition(''); } elseif ($parent = $service->getAttribute('parent')) { if (!empty($this->instanceof)) { - throw new InvalidArgumentException(sprintf('The service "%s" cannot use the "parent" option in the same file where "instanceof" configuration is defined as using both is not supported. Try moving your child definitions to a different file.', $service->getAttribute('id'))); + throw new InvalidArgumentException(sprintf('The service "%s" cannot use the "parent" option in the same file where "instanceof" configuration is defined as using both is not supported. Move your child definitions to a separate file.', $service->getAttribute('id'))); } - if (!empty($defaults)) { - throw new InvalidArgumentException(sprintf('The service "%s" cannot use the "parent" option in the same file where "defaults" configuration is defined as using both is not supported. Try moving your child definitions to a different file.', $service->getAttribute('id'))); + foreach ($defaults as $k => $v) { + if ('tags' === $k) { + // since tags are never inherited from parents, there is no confusion + // thus we can safely add them as defaults to ChildDefinition + continue; + } + if (!$service->hasAttribute($k)) { + throw new InvalidArgumentException(sprintf('Attribute "%s" on service "%s" cannot be inherited from "defaults" when a "parent" is set. Move your child definitions to a separate file or define this attribute explicitly.', $k, $service->getAttribute('id'))); + } } $definition = new ChildDefinition($parent); @@ -373,8 +381,9 @@ private function parseFileToDOM($file) * * @param \DOMDocument $xml * @param string $file + * @param array $defaults */ - private function processAnonymousServices(\DOMDocument $xml, $file) + private function processAnonymousServices(\DOMDocument $xml, $file, $defaults) { $definitions = array(); $count = 0; @@ -414,7 +423,7 @@ private function processAnonymousServices(\DOMDocument $xml, $file) // resolve definitions uksort($definitions, 'strnatcmp'); foreach (array_reverse($definitions) as $id => list($domElement, $file, $wild)) { - if (null !== $definition = $this->parseDefinition($domElement, $file)) { + if (null !== $definition = $this->parseDefinition($domElement, $file, $wild ? $defaults : array())) { $this->setDefinition($id, $definition); } diff --git a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php index e4b2a1ba6fe3..3214f4e023cb 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php @@ -354,11 +354,18 @@ private function parseDefinition($id, $service, $file, array $defaults) $definition = new ChildDefinition(''); } elseif (isset($service['parent'])) { if (!empty($this->instanceof)) { - throw new InvalidArgumentException(sprintf('The service "%s" cannot use the "parent" option in the same file where "_instanceof" configuration is defined as using both is not supported. Try moving your child definitions to a different file.', $id)); + throw new InvalidArgumentException(sprintf('The service "%s" cannot use the "parent" option in the same file where "_instanceof" configuration is defined as using both is not supported. Move your child definitions to a separate file.', $id)); } - if (!empty($defaults)) { - throw new InvalidArgumentException(sprintf('The service "%s" cannot use the "parent" option in the same file where "_defaults" configuration is defined as using both is not supported. Try moving your child definitions to a different file.', $id)); + foreach ($defaults as $k => $v) { + if ('tags' === $k) { + // since tags are never inherited from parents, there is no confusion + // thus we can safely add them as defaults to ChildDefinition + continue; + } + if (!isset($service[$k])) { + throw new InvalidArgumentException(sprintf('Attribute "%s" on service "%s" cannot be inherited from "_defaults" when a "parent" is set. Move your child definitions to a separate file or define this attribute explicitly.', $k, $id)); + } } $definition = new ChildDefinition($service['parent']); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php index a1856dfe8482..15c827d8270d 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php @@ -181,6 +181,12 @@ public function getYamlCompileTests() 'child_service_expected', ); + yield array( + 'defaults_child_tags', + 'child_service', + 'child_service_expected', + ); + yield array( 'defaults_instanceof_importance', 'main_service', diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services29.xml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services28.xml similarity index 77% rename from src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services29.xml rename to src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services28.xml index 1ce2d961eb93..9c3ba9bbb506 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services29.xml +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services28.xml @@ -5,8 +5,9 @@ + - - + + diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/integration/defaults_child_tags/expected.yml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/integration/defaults_child_tags/expected.yml new file mode 100644 index 000000000000..cb36636e0021 --- /dev/null +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/integration/defaults_child_tags/expected.yml @@ -0,0 +1,8 @@ +services: + child_service_expected: + class: stdClass + # set explicitly on child (not overridden by parent) + autoconfigure: false + # set explicitly on child + autowire: true + tags: [from_defaults] diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/integration/defaults_child_tags/main.yml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/integration/defaults_child_tags/main.yml new file mode 100644 index 000000000000..b5dc66ff0eb0 --- /dev/null +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/integration/defaults_child_tags/main.yml @@ -0,0 +1,18 @@ +services: + _defaults: + autoconfigure: true + autowire: true + tags: [from_defaults] + + parent_service: + class: stdClass + # will not override child + autoconfigure: true + # parent definitions are not applied to children + tags: [from_parent] + + child_service: + parent: parent_service + # _defaults is ok because these are explicitly set + autoconfigure: false + autowire: true diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services28.yml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services28.yml index bc4b6b098f21..fd0ce4cf96d9 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services28.yml +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services28.yml @@ -27,3 +27,8 @@ services: with_defaults_aliased_short: '@with_defaults' Acme\WithShortCutArgs: [foo] + + child_def: + parent: with_defaults + public: true + autowire: false diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php index db48db99c603..c93f7b0fdff1 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php @@ -643,7 +643,7 @@ public function testDefaults() { $container = new ContainerBuilder(); $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml')); - $loader->load('services29.xml'); + $loader->load('services28.xml'); $this->assertFalse($container->getDefinition('with_defaults')->isPublic()); $this->assertSame(array('foo' => array(array())), $container->getDefinition('with_defaults')->getTags()); @@ -658,6 +658,22 @@ public function testDefaults() $this->assertSame(array('foo' => array(array())), $container->getDefinition('no_defaults')->getTags()); $this->assertFalse($container->getDefinition('no_defaults')->isAutowired()); + + + $this->assertTrue($container->getDefinition('child_def')->isPublic()); + $this->assertSame(array('foo' => array(array())), $container->getDefinition('child_def')->getTags()); + $this->assertFalse($container->getDefinition('child_def')->isAutowired()); + + $definitions = $container->getDefinitions(); + $this->assertSame('service_container', key($definitions)); + + array_shift($definitions); + $this->assertStringStartsWith('1_', key($definitions)); + + $anonymous = current($definitions); + $this->assertTrue($anonymous->isPublic()); + $this->assertTrue($anonymous->isAutowired()); + $this->assertSame(array('foo' => array(array())), $anonymous->getTags()); } public function testNamedArguments() @@ -689,7 +705,7 @@ public function testInstanceof() /** * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException - * @expectedExceptionMessage The service "child_service" cannot use the "parent" option in the same file where "instanceof" configuration is defined as using both is not supported. Try moving your child definitions to a different file. + * @expectedExceptionMessage The service "child_service" cannot use the "parent" option in the same file where "instanceof" configuration is defined as using both is not supported. Move your child definitions to a separate file. */ public function testInstanceOfAndChildDefinitionNotAllowed() { @@ -713,7 +729,7 @@ public function testAutoConfigureAndChildDefinitionNotAllowed() /** * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException - * @expectedExceptionMessage The service "child_service" cannot use the "parent" option in the same file where "defaults" configuration is defined as using both is not supported. Try moving your child definitions to a different file. + * @expectedExceptionMessage Attribute "autowire" on service "child_service" cannot be inherited from "defaults" when a "parent" is set. Move your child definitions to a separate file or define this attribute explicitly. */ public function testDefaultsAndChildDefinitionNotAllowed() { diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php index 6407112b407d..a413df8dbc0b 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php @@ -418,6 +418,10 @@ public function testDefaults() $this->assertTrue($container->getDefinition('with_null')->isAutowired()); $this->assertFalse($container->getDefinition('no_defaults')->isAutowired()); + + $this->assertTrue($container->getDefinition('child_def')->isPublic()); + $this->assertSame(array('foo' => array(array())), $container->getDefinition('child_def')->getTags()); + $this->assertFalse($container->getDefinition('child_def')->isAutowired()); } public function testNamedArguments() @@ -451,7 +455,7 @@ public function testInstanceof() /** * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException - * @expectedExceptionMessage The service "child_service" cannot use the "parent" option in the same file where "_instanceof" configuration is defined as using both is not supported. Try moving your child definitions to a different file. + * @expectedExceptionMessage The service "child_service" cannot use the "parent" option in the same file where "_instanceof" configuration is defined as using both is not supported. Move your child definitions to a separate file. */ public function testInstanceOfAndChildDefinitionNotAllowed() { @@ -475,7 +479,7 @@ public function testAutoConfigureAndChildDefinitionNotAllowed() /** * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException - * @expectedExceptionMessage The service "child_service" cannot use the "parent" option in the same file where "_defaults" configuration is defined as using both is not supported. Try moving your child definitions to a different file. + * @expectedExceptionMessage Attribute "autowire" on service "child_service" cannot be inherited from "_defaults" when a "parent" is set. Move your child definitions to a separate file or define this attribute explicitly. */ public function testDefaultsAndChildDefinitionNotAllowed() {