1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 05:50:42 +02:00

[ticket/16649] Add compiler pass to make all services public

This also handles BC for phpBB extensions

PHPBB3-16639
This commit is contained in:
rxu
2020-12-09 00:28:38 +07:00
parent 157a8aca01
commit 302632d240
60 changed files with 43 additions and 105 deletions

View File

@@ -0,0 +1,40 @@
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @license GNU General Public License, version 2 (GPL-2.0)
*
* For full copyright and license information, please see
* the docs/CREDITS.txt file.
*
*/
namespace phpbb\di\pass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
/**
* Marks all services public
*/
class markpublic_pass implements CompilerPassInterface
{
/**
* Modify the container before it is passed to the rest of the code
*
* @param ContainerBuilder $container ContainerBuilder object
* @return null
*/
public function process(ContainerBuilder $container)
{
foreach ($container->getDefinitions() as $definition)
{
if ($definition->isPrivate())
{
$definition->setPublic(true);
}
}
}
}