Unverified Commit 47344caf authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3187857 by longwave, ilgnerfagundes, catch, alexpott: [Symfony 6]...

Issue #3187857 by longwave, ilgnerfagundes, catch, alexpott: [Symfony 6] Service deprecation messages require more fields
parent 99e29476
Loading
Loading
Loading
Loading
+14 −0
Changes for core/lib/Drupal/Core/DependencyInjection/YamlFileLoader.php: 14 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -157,8 +157,15 @@ private function parseDefinition($id, $service, $file)
            }

            if (array_key_exists('deprecated', $service)) {
                if (method_exists($alias, 'getDeprecation')) {
                    $deprecation = \is_array($service['deprecated']) ? $service['deprecated'] : ['message' => $service['deprecated']];
                    $alias->setDeprecated($deprecation['package'] ?? '', $deprecation['version'] ?? '', $deprecation['message']);
                } else {
                    // @todo Remove when we no longer support Symfony 4 in
                    // https://www.drupal.org/project/drupal/issues/3197729
                    $alias->setDeprecated(true, $service['deprecated']);
                }
            }

            return;
        }
@@ -197,8 +204,15 @@ private function parseDefinition($id, $service, $file)
        }

        if (array_key_exists('deprecated', $service)) {
            if (method_exists($definition, 'getDeprecation')) {
                $deprecation = \is_array($service['deprecated']) ? $service['deprecated'] : ['message' => $service['deprecated']];
                $definition->setDeprecated($deprecation['package'] ?? '', $deprecation['version'] ?? '', $deprecation['message']);
            } else {
                // @todo Remove when we no longer support Symfony 4 in
                // https://www.drupal.org/project/drupal/issues/3197729
                $definition->setDeprecated(true, $service['deprecated']);
            }
        }

        if (isset($service['factory'])) {
            if (is_string($service['factory'])) {
+7 −0
Changes for core/lib/Drupal/Core/Update/UpdateServiceProvider.php: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -19,7 +19,14 @@ class UpdateServiceProvider implements ServiceProviderInterface, ServiceModifier
   */
  public function register(ContainerBuilder $container) {
    $definition = new Definition('Drupal\Core\Cache\NullBackend', ['null']);
    if (method_exists($definition, 'getDeprecation')) {
      $definition->setDeprecated('drupal/core', '8.8.0', 'The "%service_id%\" service is deprecated. While updating Drupal all caches use \Drupal\Core\Update\UpdateBackend. See https://www.drupal.org/node/3066407');
    }
    else {
      // @todo Remove when we no longer support Symfony 4 in
      // https://www.drupal.org/project/drupal/issues/3197729
      $definition->setDeprecated(TRUE, 'The "%service_id%\" service is deprecated. While updating Drupal all caches use \Drupal\Core\Update\UpdateBackend. See https://www.drupal.org/node/3066407');
    }
    $definition->setPublic(TRUE);
    $container->setDefinition('cache.null', $definition);