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 fa99591

Browse filesBrowse files
committed
[FrameworkBundle] Deprecate some public services to private
1 parent 75e71e3 commit fa99591
Copy full SHA for fa99591

File tree

21 files changed

+95
-12
lines changed
Filter options

21 files changed

+95
-12
lines changed

‎UPGRADE-5.2.md

Copy file name to clipboard
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
UPGRADE FROM 5.1 to 5.2
2+
=======================
3+
4+
FrameworkBundle
5+
---------------
6+
7+
* Deprecated the public `form.factory`, `form.type.file`, `translator`, `security.csrf.token_manager`, `serializer`,
8+
`cache_clearer`, `filesystem` and `validator` services to private.

‎UPGRADE-6.0.md

Copy file name to clipboardExpand all lines: UPGRADE-6.0.md
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ FrameworkBundle
5353
* `MicroKernelTrait::configureRoutes()` is now always called with a `RoutingConfigurator`
5454
* The "framework.router.utf8" configuration option defaults to `true`
5555
* Removed `session.attribute_bag` service and `session.flash_bag` service.
56+
* The `form.factory`, `form.type.file`, `translator`, `security.csrf.token_manager`, `serializer`,
57+
`cache_clearer`, `filesystem` and `validator` services are now private.
5658

5759
HttpFoundation
5860
--------------

‎src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
CHANGELOG
22
=========
33

4+
5.2.0
5+
-----
6+
7+
* Deprecated the public `form.factory`, `form.type.file`, `translator`, `security.csrf.token_manager`, `serializer`,
8+
`cache_clearer`, `filesystem` and `validator` services to private.
9+
410
5.1.0
511
-----
612

‎src/Symfony/Bundle/FrameworkBundle/Resources/config/form.xml

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Resources/config/form.xml
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
<!-- FormFactory -->
3030
<service id="form.factory" class="Symfony\Component\Form\FormFactory" public="true">
31+
<tag name="container.private" package="symfony/framework-bundle" version="5.2" />
3132
<argument type="service" id="form.registry" />
3233
</service>
3334
<service id="Symfony\Component\Form\FormFactoryInterface" alias="form.factory" />
@@ -72,6 +73,7 @@
7273
</service>
7374
<service id="form.type.file" class="Symfony\Component\Form\Extension\Core\Type\FileType" public="true">
7475
<tag name="form.type" />
76+
<tag name="container.private" package="symfony/framework-bundle" version="5.2" />
7577
<argument type="service" id="translator" on-invalid="ignore" />
7678
</service>
7779
<service id="form.type.color" class="Symfony\Component\Form\Extension\Core\Type\ColorType">

‎src/Symfony/Bundle/FrameworkBundle/Resources/config/identity_translator.xml

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Resources/config/identity_translator.xml
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
<services>
77
<defaults public="false" />
88

9-
<service id="translator" class="Symfony\Component\Translation\IdentityTranslator" public="true" />
9+
<service id="translator" class="Symfony\Component\Translation\IdentityTranslator" public="true">
10+
<tag name="container.private" package="symfony/framework-bundle" version="5.2" />
11+
</service>
1012
<service id="Symfony\Contracts\Translation\TranslatorInterface" alias="translator" />
1113

1214
<service id="identity_translator" class="Symfony\Component\Translation\IdentityTranslator" />

‎src/Symfony/Bundle/FrameworkBundle/Resources/config/security_csrf.xml

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Resources/config/security_csrf.xml
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
<argument type="service" id="security.csrf.token_generator" />
2020
<argument type="service" id="security.csrf.token_storage" />
2121
<argument type="service" id="request_stack" on-invalid="ignore" />
22+
<tag name="container.private" package="symfony/framework-bundle" version="5.2" />
2223
</service>
2324
<service id="Symfony\Component\Security\Csrf\CsrfTokenManagerInterface" alias="security.csrf.token_manager" />
2425

‎src/Symfony/Bundle/FrameworkBundle/Resources/config/serializer.xml

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Resources/config/serializer.xml
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<service id="serializer" class="Symfony\Component\Serializer\Serializer" public="true">
1616
<argument type="collection" />
1717
<argument type="collection" />
18+
<tag name="container.private" package="symfony/framework-bundle" version="5.2" />
1819
</service>
1920
<service id="Symfony\Component\Serializer\SerializerInterface" alias="serializer" />
2021
<service id="Symfony\Component\Serializer\Normalizer\NormalizerInterface" alias="serializer" />

‎src/Symfony/Bundle/FrameworkBundle/Resources/config/services.xml

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Resources/config/services.xml
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,15 @@
7474

7575
<service id="cache_clearer" class="Symfony\Component\HttpKernel\CacheClearer\ChainCacheClearer" public="true">
7676
<argument type="tagged_iterator" tag="kernel.cache_clearer" />
77+
<tag name="container.private" package="symfony/framework-bundle" version="5.2" />
7778
</service>
7879

7980
<service id="kernel" synthetic="true" public="true" />
8081
<service id="Symfony\Component\HttpKernel\KernelInterface" alias="kernel" />
8182

82-
<service id="filesystem" class="Symfony\Component\Filesystem\Filesystem" public="true" />
83+
<service id="filesystem" class="Symfony\Component\Filesystem\Filesystem" public="true">
84+
<tag name="container.private" package="symfony/framework-bundle" version="5.2" />
85+
</service>
8386
<service id="Symfony\Component\Filesystem\Filesystem" alias="filesystem" />
8487

8588
<service id="file_locator" class="Symfony\Component\HttpKernel\Config\FileLocator">

‎src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.xml

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.xml
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
<service id="validator" class="Symfony\Component\Validator\Validator\ValidatorInterface" public="true">
1616
<factory service="validator.builder" method="getValidator" />
17+
<tag name="container.private" package="symfony/framework-bundle" version="5.2" />
1718
</service>
1819
<service id="Symfony\Component\Validator\Validator\ValidatorInterface" alias="validator" />
1920

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/validation_annotations.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/validation_annotations.php
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@
77
'enable_annotations' => true,
88
],
99
]);
10+
11+
$container->setAlias('validator.alias', 'validator')->setPublic(true);

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/validation_annotations.xml

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/validation_annotations.xml
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,8 @@
99
<framework:config secret="s3cr3t">
1010
<framework:validation enabled="true" enable-annotations="true" />
1111
</framework:config>
12+
13+
<services>
14+
<service id="validator.alias" alias="validator" public="true" />
15+
</services>
1216
</container>

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/validation_annotations.yml

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/validation_annotations.yml
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,8 @@ framework:
33
validation:
44
enabled: true
55
enable_annotations: true
6+
7+
services:
8+
validator.alias:
9+
alias: validator
10+
public: true

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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,7 @@ public function testValidationService()
839839
{
840840
$container = $this->createContainerFromFile('validation_annotations', ['kernel.charset' => 'UTF-8'], false);
841841

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

845845
public function testAnnotations()

‎src/Symfony/Bundle/FrameworkBundle/Tests/Functional/BundlePathsTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/Functional/BundlePathsTest.php
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function testBundleTwigTemplatesDir()
5353
public function testBundleTranslationsDir()
5454
{
5555
static::bootKernel(['test_case' => 'BundlePaths']);
56-
$translator = static::$container->get('translator');
56+
$translator = static::$container->get('translator.alias');
5757

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

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

8181
$this->assertEquals(['full_name' => 'john', 'age' => 5], $serializer->normalize(new LegacyPerson('john', 5), 'json'));
8282
$this->assertEquals(['full_name' => 'john', 'age' => 5], $serializer->normalize(new ModernPerson('john', 5), 'json'));

‎src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolsTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/Functional/CachePoolsTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ private function doTestCachePools($options, $adapterClass)
9696
$pool2 = $container->get('cache.pool2');
9797
$pool2->save($item);
9898

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

‎src/Symfony/Bundle/FrameworkBundle/Tests/Functional/SerializerTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/Functional/SerializerTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function testDeserializeArrayOfObject()
2020
{
2121
static::bootKernel(['test_case' => 'Serializer']);
2222

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

2525
$bar1 = new Bar();
2626
$bar1->id = 1;

‎src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/BundlePaths/config.yml

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/BundlePaths/config.yml
+13Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,16 @@ framework:
88

99
twig:
1010
strict_variables: '%kernel.debug%'
11+
12+
services:
13+
validator.alias:
14+
alias: validator
15+
public: true
16+
17+
serializer.alias:
18+
alias: serializer
19+
public: true
20+
21+
translator.alias:
22+
alias: translator
23+
public: true

‎src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/CachePools/config.yml

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/CachePools/config.yml
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,8 @@ framework:
2424
cache.pool7:
2525
adapter: cache.pool4
2626
public: true
27+
28+
services:
29+
cache_clearer.alias:
30+
alias: cache_clearer
31+
public: true

‎src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/Serializer/config.yml

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/Serializer/config.yml
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,8 @@ imports:
44
framework:
55
serializer: { enabled: true }
66
property_info: { enabled: true }
7+
8+
services:
9+
serializer.alias:
10+
alias: serializer
11+
public: true

‎src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/CsrfFormLoginBundle/Controller/LoginController.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/CsrfFormLoginBundle/Controller/LoginController.php
+22-4Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,21 @@
1111

1212
namespace Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\CsrfFormLoginBundle\Controller;
1313

14-
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
15-
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
14+
use Psr\Container\ContainerInterface;
15+
use Symfony\Component\Form\FormFactoryInterface;
1616
use Symfony\Component\HttpFoundation\Response;
1717
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
18+
use Symfony\Contracts\Service\ServiceSubscriberInterface;
19+
use Twig\Environment;
1820

19-
class LoginController implements ContainerAwareInterface
21+
class LoginController implements ServiceSubscriberInterface
2022
{
21-
use ContainerAwareTrait;
23+
private $container;
24+
25+
public function __construct(ContainerInterface $container)
26+
{
27+
$this->container = $container;
28+
}
2229

2330
public function loginAction()
2431
{
@@ -43,4 +50,15 @@ public function secureAction()
4350
{
4451
throw new \Exception('Wrapper', 0, new \Exception('Another Wrapper', 0, new AccessDeniedException()));
4552
}
53+
54+
/**
55+
* {@inheritdoc}
56+
*/
57+
public static function getSubscribedServices()
58+
{
59+
return [
60+
'form.factory' => FormFactoryInterface::class,
61+
'twig' => Environment::class,
62+
];
63+
}
4664
}

‎src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/CsrfFormLogin/config.yml

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/CsrfFormLogin/config.yml
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ services:
99
tags:
1010
- { name: form.type }
1111

12+
Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\CsrfFormLoginBundle\Controller\LoginController:
13+
public: true
14+
tags:
15+
- { name: container.service_subscriber }
16+
1217
security:
1318
encoders:
1419
Symfony\Component\Security\Core\User\User: plaintext

0 commit comments

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