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:
40
phpBB/phpbb/di/pass/markpublic_pass.php
Normal file
40
phpBB/phpbb/di/pass/markpublic_pass.php
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user