Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions UPGRADE-5.2.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ DependencyInjection

* Deprecated `Definition::setPrivate()` and `Alias::setPrivate()`, use `setPublic()` instead

FrameworkBundle
---------------

* Deprecated the public `form.factory`, `form.type.file`, `translator`, `security.csrf.token_manager`, `serializer`,
`cache_clearer`, `filesystem` and `validator` services to private.

Mime
----

Expand Down
2 changes: 2 additions & 0 deletions UPGRADE-6.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ FrameworkBundle
* `MicroKernelTrait::configureRoutes()` is now always called with a `RoutingConfigurator`
* The "framework.router.utf8" configuration option defaults to `true`
* Removed `session.attribute_bag` service and `session.flash_bag` service.
* The `form.factory`, `form.type.file`, `translator`, `security.csrf.token_manager`, `serializer`,
`cache_clearer`, `filesystem` and `validator` services are now private.

HttpFoundation
--------------
Expand Down
2 changes: 2 additions & 0 deletions src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ CHANGELOG

* Added `framework.http_cache` configuration tree
* Added `framework.trusted_proxies` and `framework.trusted_headers` configuration options
* Deprecated the public `form.factory`, `form.type.file`, `translator`, `security.csrf.token_manager`, `serializer`,
`cache_clearer`, `filesystem` and `validator` services to private.

5.1.0
-----
Expand Down
2 changes: 2 additions & 0 deletions src/Symfony/Bundle/FrameworkBundle/Resources/config/form.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
->set('form.factory', FormFactory::class)
->public()
->args([service('form.registry')])
->tag('container.private', ['package' => 'symfony/framework-bundle', 'version' => '5.2'])

->alias(FormFactoryInterface::class, 'form.factory')

Expand Down Expand Up @@ -103,6 +104,7 @@
->public()
->args([service('translator')->ignoreOnInvalid()])
->tag('form.type')
->tag('container.private', ['package' => 'symfony/framework-bundle', 'version' => '5.2'])

->set('form.type.color', ColorType::class)
->args([service('translator')->ignoreOnInvalid()])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
$container->services()
->set('translator', IdentityTranslator::class)
->public()
->tag('container.private', ['package' => 'symfony/framework-bundle', 'version' => '5.2'])
->alias(TranslatorInterface::class, 'translator')

->set('identity_translator', IdentityTranslator::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
service('security.csrf.token_storage'),
service('request_stack')->ignoreOnInvalid(),
])
->tag('container.private', ['package' => 'symfony/framework-bundle', 'version' => '5.2'])

->alias(CsrfTokenManagerInterface::class, 'security.csrf.token_manager')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
->set('serializer', Serializer::class)
->public()
->args([[], []])
->tag('container.private', ['package' => 'symfony/framework-bundle', 'version' => '5.2'])

->alias(SerializerInterface::class, 'serializer')
->alias(NormalizerInterface::class, 'serializer')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ class_exists(WorkflowEvents::class) ? WorkflowEvents::ALIASES : []
->args([
tagged_iterator('kernel.cache_clearer'),
])
->tag('container.private', ['package' => 'symfony/framework-bundle', 'version' => '5.2'])

->set('kernel')
->synthetic()
Expand All @@ -126,6 +127,7 @@ class_exists(WorkflowEvents::class) ? WorkflowEvents::ALIASES : []

->set('filesystem', Filesystem::class)
->public()
->tag('container.private', ['package' => 'symfony/framework-bundle', 'version' => '5.2'])
->alias(Filesystem::class, 'filesystem')

->set('file_locator', FileLocator::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
->set('validator', ValidatorInterface::class)
->public()
->factory([service('validator.builder'), 'getValidator'])
->tag('container.private', ['package' => 'symfony/framework-bundle', 'version' => '5.2'])
->alias(ValidatorInterface::class, 'validator')

->set('validator.builder', ValidatorBuilder::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@
'enable_annotations' => true,
],
]);

$container->setAlias('validator.alias', 'validator')->setPublic(true);
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,8 @@
<framework:config secret="s3cr3t">
<framework:validation enabled="true" enable-annotations="true" />
</framework:config>

<services>
<service id="validator.alias" alias="validator" public="true" />
</services>
</container>
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,8 @@ framework:
validation:
enabled: true
enable_annotations: true

services:
validator.alias:
alias: validator
public: true
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,7 @@ public function testValidationService()
{
$container = $this->createContainerFromFile('validation_annotations', ['kernel.charset' => 'UTF-8'], false);

$this->assertInstanceOf('Symfony\Component\Validator\Validator\ValidatorInterface', $container->get('validator'));
$this->assertInstanceOf('Symfony\Component\Validator\Validator\ValidatorInterface', $container->get('validator.alias'));
}

public function testAnnotations()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function testBundleTwigTemplatesDir()
public function testBundleTranslationsDir()
{
static::bootKernel(['test_case' => 'BundlePaths']);
$translator = static::$container->get('translator');
$translator = static::$container->get('translator.alias');

$this->assertSame('OK', $translator->trans('ok_label', [], 'legacy'));
$this->assertSame('OK', $translator->trans('ok_label', [], 'modern'));
Expand All @@ -62,7 +62,7 @@ public function testBundleTranslationsDir()
public function testBundleValidationConfigDir()
{
static::bootKernel(['test_case' => 'BundlePaths']);
$validator = static::$container->get('validator');
$validator = static::$container->get('validator.alias');

$this->assertTrue($validator->hasMetadataFor(LegacyPerson::class));
$this->assertCount(1, $constraintViolationList = $validator->validate(new LegacyPerson('john', 5)));
Expand All @@ -76,7 +76,7 @@ public function testBundleValidationConfigDir()
public function testBundleSerializationConfigDir()
{
static::bootKernel(['test_case' => 'BundlePaths']);
$serializer = static::$container->get('serializer');
$serializer = static::$container->get('serializer.alias');

$this->assertEquals(['full_name' => 'john', 'age' => 5], $serializer->normalize(new LegacyPerson('john', 5), 'json'));
$this->assertEquals(['full_name' => 'john', 'age' => 5], $serializer->normalize(new ModernPerson('john', 5), 'json'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ private function doTestCachePools($options, $adapterClass)
$pool2 = $container->get('cache.pool2');
$pool2->save($item);

$container->get('cache_clearer')->clear($container->getParameter('kernel.cache_dir'));
$container->get('cache_clearer.alias')->clear($container->getParameter('kernel.cache_dir'));
$item = $pool1->getItem($key);
$this->assertFalse($item->isHit());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function testDeserializeArrayOfObject()
{
static::bootKernel(['test_case' => 'Serializer']);

$result = static::$container->get('serializer')->deserialize('{"bars": [{"id": 1}, {"id": 2}]}', Foo::class, 'json');
$result = static::$container->get('serializer.alias')->deserialize('{"bars": [{"id": 1}, {"id": 2}]}', Foo::class, 'json');

$bar1 = new Bar();
$bar1->id = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,15 @@ twig:
services:
twig.alias:
alias: twig

validator.alias:
alias: validator
public: true

serializer.alias:
alias: serializer
public: true

translator.alias:
alias: translator
public: true
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,8 @@ framework:
cache.pool7:
adapter: cache.pool4
public: true

services:
cache_clearer.alias:
alias: cache_clearer
public: true
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,8 @@ imports:
framework:
serializer: { enabled: true }
property_info: { enabled: true }

services:
serializer.alias:
alias: serializer
public: true