diff --git a/core/lib/Drupal/Core/Config/ConfigManager.php b/core/lib/Drupal/Core/Config/ConfigManager.php index 0761cb7398..f8ca052f33 100644 --- a/core/lib/Drupal/Core/Config/ConfigManager.php +++ b/core/lib/Drupal/Core/Config/ConfigManager.php @@ -295,19 +295,19 @@ public function getConfigEntitiesToChangeOnDependencyRemoval($type, array $names // Determine the current list of dependent configuration entities and set up // initial values. $dependency_manager = $this->getConfigDependencyManager(); - $dependents = $this->findConfigEntityDependentsAsEntities($type, $names, $dependency_manager); + $original_dependencies = $this->findConfigEntityDependentsAsEntities($type, $names, $dependency_manager); // Store the list of dependencies in three separate variables. This allows // us to determine how the dependency graph changes as entities are fixed by // calling the onDependencyRemoval() method. The variables are: - // - $dependents is the list of dependencies to process. This list changes - // as entities are processed and either fixed or deleted. // - $current_dependencies is the list of dependencies on $names. This list // is recalculated when calling an entity's onDependencyRemoval() method // results in the entity changing. This list is passed to each entity's // onDependencyRemoval() method as the list of affected entities. + // - $dependencies_to_process is the list of dependencies to process. This list changes + // as entities are processed and either fixed or deleted. // - $original_dependencies is the list of original dependencies on $names. // This list never changes. - $original_dependencies = $current_dependencies = $dependents; + $dependencies_to_process = $current_dependencies = $original_dependencies; $affected_uuids = []; $return = [ @@ -321,7 +321,7 @@ public function getConfigEntitiesToChangeOnDependencyRemoval($type, array $names // first. For example, this ensures that Menu UI third party dependencies on // node types are fixed before processing the node type's other // dependencies. - while ($dependent = array_pop($dependents)) { + while ($dependent = array_pop($dependencies_to_process)) { /** @var \Drupal\Core\Config\Entity\ConfigEntityInterface $dependent */ if ($dry_run) { // Clone the entity so any changes do not change any static caches. @@ -339,17 +339,17 @@ public function getConfigEntitiesToChangeOnDependencyRemoval($type, array $names // Rebuild the list of entities that we need to process using the new // list of current dependencies and removing any entities that we've // already processed. - $dependents = array_filter($current_dependencies, function ($current_dependency) use ($affected_uuids) { + $dependencies_to_process = array_filter($current_dependencies, function ($current_dependency) use ($affected_uuids) { return !in_array($current_dependency->uuid(), $affected_uuids); }); // Ensure that the dependency has actually been fixed. It is possible // that the dependent has multiple dependencies that cause it to be in // the dependency chain. $fixed = TRUE; - foreach ($dependents as $key => $entity) { + foreach ($dependencies_to_process as $key => $entity) { if ($entity->uuid() == $dependent->uuid()) { $fixed = FALSE; - unset($dependents[$key]); + unset($dependencies_to_process[$key]); break; } }