for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Knp\RadBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
class RemoveUnavailableServicesPass implements CompilerPassInterface
{
/**
* {@inheritDoc}
*/
public function process(ContainerBuilder $container)
foreach ($container->findTaggedServiceIds('remove-when-missing') as $id => $tags) {
foreach ($tags as $tag) {
if (!isset($tag['service'])) {
continue;
}
if ($container->hasDefinition($tag['service'])) {
if ($container->hasAlias($tag['service'])) {
$container->removeDefinition($id);