ResolvePrivatesPass.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\DependencyInjection\Compiler;
  11. trigger_deprecation('symfony/dependency-injection', '5.2', 'The "%s" class is deprecated.', ResolvePrivatesPass::class);
  12. use Symfony\Component\DependencyInjection\ContainerBuilder;
  13. /**
  14. * @author Nicolas Grekas <p@tchwork.com>
  15. *
  16. * @deprecated since Symfony 5.2
  17. */
  18. class ResolvePrivatesPass implements CompilerPassInterface
  19. {
  20. /**
  21. * {@inheritdoc}
  22. */
  23. public function process(ContainerBuilder $container)
  24. {
  25. foreach ($container->getDefinitions() as $id => $definition) {
  26. if ($definition->isPrivate()) {
  27. $definition->setPublic(false);
  28. $definition->setPrivate(true);
  29. }
  30. }
  31. foreach ($container->getAliases() as $id => $alias) {
  32. if ($alias->isPrivate()) {
  33. $alias->setPublic(false);
  34. $alias->setPrivate(true);
  35. }
  36. }
  37. }
  38. }