public function UpdateCompilerPass::process in Drupal 9        
                          
                  
                        Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Update/UpdateCompilerPass.php \Drupal\Core\Update\UpdateCompilerPass::process()
File
 
   - core/lib/Drupal/Core/Update/UpdateCompilerPass.php, line 21
Class
  
  - UpdateCompilerPass 
- Removes services with unmet dependencies.
Namespace
  Drupal\Core\Update
Code
public function process(ContainerBuilder $container) {
  $process_aliases = FALSE;
  
  do {
    $has_changed = FALSE;
    foreach ($container
      ->getDefinitions() as $key => $definition) {
      
      foreach ($definition
        ->getArguments() as $argument) {
        if ($this
          ->isArgumentMissingService($argument, $container)) {
          $container
            ->removeDefinition($key);
          $container
            ->log($this, sprintf('Removed service "%s"; reason: depends on non-existent service "%s".', $key, (string) $argument));
          $has_changed = TRUE;
          $process_aliases = TRUE;
          
          continue 2;
        }
      }
      
      foreach ($definition
        ->getMethodCalls() as $call) {
        foreach ($call[1] as $argument) {
          if ($this
            ->isArgumentMissingService($argument, $container)) {
            $container
              ->removeDefinition($key);
            $container
              ->log($this, sprintf('Removed service "%s"; reason: method call "%s" depends on non-existent service "%s".', $key, $call[0], (string) $argument));
            $has_changed = TRUE;
            $process_aliases = TRUE;
            
            continue 3;
          }
        }
      }
    }
    
  } while ($has_changed);
  
  if ($process_aliases) {
    foreach ($container
      ->getAliases() as $key => $alias) {
      $id = (string) $alias;
      if (!$container
        ->has($id)) {
        $container
          ->removeAlias($key);
        $container
          ->log($this, sprintf('Removed alias "%s"; reason: alias to non-existent service "%s".', $key, $id));
      }
    }
  }
}