Skip to content

Commit 6d0302b

Browse files
committed
feature #37373 [DI] deprecate Definition/Alias::setPrivate() (nicolas-grekas)
This PR was merged into the 5.2-dev branch. Discussion ---------- [DI] deprecate Definition/Alias::setPrivate() | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | Deprecations? | yes | Tickets | - | License | MIT | Doc PR | - Right now, there is a very subtle difference between `setPublic()` and `setPrivate()` that dates back to the FC/BC layer we created to turn services private by default. We kept this difference to help third party bundles provide support for a wide range of versions of Symfony, but since 5.2 will be released at the same time as 3.4 will enter EOM, we should remove this behavior and deprecate `setPrivate()` to signal the change. This is what this PR does. Commits ------- 1bea690f4d [DI] deprecate Definition/Alias::setPrivate()
2 parents 2369a98 + ab257ee commit 6d0302b

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

DependencyInjection/FrameworkExtension.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,6 @@ private function registerWorkflowConfiguration(array $config, ContainerBuilder $
796796
// Enable the AuditTrail
797797
if ($workflow['audit_trail']['enabled']) {
798798
$listener = new Definition(Workflow\EventListener\AuditTrailListener::class);
799-
$listener->setPrivate(true);
800799
$listener->addTag('monolog.logger', ['channel' => 'workflow']);
801800
$listener->addTag('kernel.event_listener', ['event' => sprintf('workflow.%s.leave', $name), 'method' => 'onLeave']);
802801
$listener->addTag('kernel.event_listener', ['event' => sprintf('workflow.%s.transition', $name), 'method' => 'onTransition']);
@@ -816,7 +815,6 @@ private function registerWorkflowConfiguration(array $config, ContainerBuilder $
816815
}
817816

818817
$guard = new Definition(Workflow\EventListener\GuardListener::class);
819-
$guard->setPrivate(true);
820818

821819
$guard->setArguments([
822820
$guardsConfiguration,
@@ -844,7 +842,6 @@ private function registerDebugConfiguration(array $config, ContainerBuilder $con
844842
if (class_exists(Stopwatch::class)) {
845843
$container->register('debug.stopwatch', Stopwatch::class)
846844
->addArgument(true)
847-
->setPrivate(true)
848845
->addTag('kernel.reset', ['method' => 'reset']);
849846
$container->setAlias(Stopwatch::class, new Alias('debug.stopwatch', false));
850847
}
@@ -953,7 +950,7 @@ private function registerSessionConfiguration(array $config, ContainerBuilder $c
953950
$loader->load('session.php');
954951

955952
// session storage
956-
$container->setAlias('session.storage', $config['storage_id'])->setPrivate(true);
953+
$container->setAlias('session.storage', $config['storage_id']);
957954
$options = ['cache_limiter' => '0'];
958955
foreach (['name', 'cookie_lifetime', 'cookie_path', 'cookie_domain', 'cookie_secure', 'cookie_httponly', 'cookie_samesite', 'use_cookies', 'gc_maxlifetime', 'gc_probability', 'gc_divisor', 'sid_length', 'sid_bits_per_character'] as $key) {
959956
if (isset($config[$key])) {
@@ -985,9 +982,9 @@ private function registerSessionConfiguration(array $config, ContainerBuilder $c
985982
$container->getDefinition('session.abstract_handler')
986983
->replaceArgument(0, $container->hasDefinition($id) ? new Reference($id) : $config['handler_id']);
987984

988-
$container->setAlias('session.handler', 'session.abstract_handler')->setPrivate(true);
985+
$container->setAlias('session.handler', 'session.abstract_handler');
989986
} else {
990-
$container->setAlias('session.handler', $config['handler_id'])->setPrivate(true);
987+
$container->setAlias('session.handler', $config['handler_id']);
991988
}
992989
}
993990

@@ -1390,7 +1387,7 @@ private function registerAnnotationsConfiguration(array $config, ContainerBuilde
13901387
->addTag('annotations.cached_reader')
13911388
;
13921389

1393-
$container->setAlias('annotation_reader', 'annotations.cached_reader')->setPrivate(true);
1390+
$container->setAlias('annotation_reader', 'annotations.cached_reader');
13941391
$container->setAlias(Reader::class, new Alias('annotations.cached_reader', false));
13951392
} else {
13961393
$container->removeDefinition('annotations.cached_reader');
@@ -1574,7 +1571,6 @@ private function registerPropertyInfoConfiguration(ContainerBuilder $container,
15741571

15751572
if (interface_exists('phpDocumentor\Reflection\DocBlockFactoryInterface')) {
15761573
$definition = $container->register('property_info.php_doc_extractor', 'Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor');
1577-
$definition->setPrivate(true);
15781574
$definition->addTag('property_info.description_extractor', ['priority' => -1000]);
15791575
$definition->addTag('property_info.type_extractor', ['priority' => -1001]);
15801576
}

0 commit comments

Comments
 (0)