mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 23:23:51 +00:00
Fix issues reported by PHPStan.
This commit is contained in:
@@ -1,35 +1,32 @@
|
||||
<?php
|
||||
/*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\MainBundle\DependencyInjection\CompilerPass;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Chill\MainBundle\Form\PermissionsGroupType;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
use LogicException;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
||||
*/
|
||||
class ACLFlagsCompilerPass implements CompilerPassInterface
|
||||
{
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
$permissionGroupType = $container->getDefinition(PermissionsGroupType::class);
|
||||
|
||||
|
||||
foreach($container->findTaggedServiceIds('chill_main.flags') as $id => $tags) {
|
||||
$reference = new Reference($id);
|
||||
|
||||
|
||||
foreach ($tags as $tag) {
|
||||
switch($tag['scope']) {
|
||||
case PermissionsGroupType::FLAG_SCOPE:
|
||||
|
||||
|
||||
$permissionGroupType->addMethodCall('addFlagProvider', [ $reference ]);
|
||||
break;
|
||||
default:
|
||||
throw new \LogicalException(sprintf(
|
||||
throw new LogicException(sprintf(
|
||||
"This tag 'scope' is not implemented: %s, on service with id %s", $tag['scope'], $id)
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user