Commit cfd1cf73 authored by catch's avatar catch
Browse files

Issue #3258435 by ravi.shankar, alexpott, longwave: Remove deprecated...

Issue #3258435 by ravi.shankar, alexpott, longwave: Remove deprecated feed.reader.* and feed.writer.* services from the container
parent affdb3e7
Loading
Loading
Loading
Loading
+0 −100
Original line number Diff line number Diff line
@@ -1415,106 +1415,6 @@ services:
  date.formatter:
    class: Drupal\Core\Datetime\DateFormatter
    arguments: ['@entity_type.manager', '@language_manager', '@string_translation', '@config.factory', '@request_stack']
  feed.bridge.reader:
    class: Drupal\Component\Bridge\ZfExtensionManagerSfContainer
    calls:
      - [setContainer, ['@service_container']]
      - [setStandalone, ['\Laminas\Feed\Reader\StandaloneExtensionManager']]
    arguments: ['feed.reader.']
    deprecated: The "%service_id%" service is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. Use \Laminas\Feed\Reader\StandaloneExtensionManager or create your own service. See https://www.drupal.org/node/3258656
  feed.bridge.writer:
    class: Drupal\Component\Bridge\ZfExtensionManagerSfContainer
    calls:
      - [setContainer, ['@service_container']]
      - [setStandalone, ['\Laminas\Feed\Writer\StandaloneExtensionManager']]
    arguments: ['feed.writer.']
    deprecated: The "%service_id%" service is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. Use \Laminas\Feed\Writer\StandaloneExtensionManager or create your own service. See https://www.drupal.org/node/3258440
# Laminas Feed reader plugins. Plugin instances should not be shared.
  feed.reader.dublincoreentry:
    class: Laminas\Feed\Reader\Extension\DublinCore\Entry
    shared: false
    deprecated: The "%service_id%" service is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. You should use \Drupal::service('feed.bridge.reader')->get('DublinCore\Entry') instead. See https://www.drupal.org/node/2979042
  feed.reader.dublincorefeed:
    class: Laminas\Feed\Reader\Extension\DublinCore\Feed
    shared: false
    deprecated: The "%service_id%" service is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. You should use \Drupal::service('feed.bridge.reader')->get('DublinCore\Feed') instead. See https://www.drupal.org/node/2979042
  feed.reader.contententry:
    class: Laminas\Feed\Reader\Extension\Content\Entry
    shared: false
    deprecated: The "%service_id%" service is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. You should use \Drupal::service('feed.bridge.reader')->get('Content\Entry') instead. See https://www.drupal.org/node/2979042
  feed.reader.atomentry:
    class: Laminas\Feed\Reader\Extension\Atom\Entry
    shared: false
    deprecated: The "%service_id%" service is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. You should use \Drupal::service('feed.bridge.reader')->get('Atom\Entry') instead. See https://www.drupal.org/node/2979042
  feed.reader.atomfeed:
    class: Laminas\Feed\Reader\Extension\Atom\Feed
    shared: false
    deprecated: The "%service_id%" service is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. You should use \Drupal::service('feed.bridge.reader')->get('Atom\Feed') instead. See https://www.drupal.org/node/2979042
  feed.reader.slashentry:
    class: Laminas\Feed\Reader\Extension\Slash\Entry
    shared: false
    deprecated: The "%service_id%" service is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. You should use \Drupal::service('feed.bridge.reader')->get('Slash\Entry') instead. See https://www.drupal.org/node/2979042
  feed.reader.wellformedwebentry:
    class: Laminas\Feed\Reader\Extension\WellFormedWeb\Entry
    shared: false
    deprecated: The "%service_id%" service is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. You should use \Drupal::service('feed.bridge.reader')->get('WellFormedWeb\Entry') instead. See https://www.drupal.org/node/2979042
  feed.reader.threadentry:
    class: Laminas\Feed\Reader\Extension\Thread\Entry
    shared: false
    deprecated: The "%service_id%" service is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. You should use \Drupal::service('feed.bridge.reader')->get('Thread\Entry') instead. See https://www.drupal.org/node/2979042
  feed.reader.podcastentry:
    class: Laminas\Feed\Reader\Extension\Podcast\Entry
    shared: false
    deprecated: The "%service_id%" service is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. You should use \Drupal::service('feed.bridge.reader')->get('Podcast\Entry') instead. See https://www.drupal.org/node/2979042
  feed.reader.podcastfeed:
    class: Laminas\Feed\Reader\Extension\Podcast\Feed
    shared: false
    deprecated: The "%service_id%" service is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. You should use \Drupal::service('feed.bridge.reader')->get('Podcast\Feed') instead. See https://www.drupal.org/node/2979042
# Laminas Feed writer plugins. Plugins should be set as prototype scope.
  feed.writer.atomrendererfeed:
    class: Laminas\Feed\Writer\Extension\Atom\Renderer\Feed
    shared: false
    deprecated: The "%service_id%" service is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. You should use \Drupal::service('feed.bridge.writer')->get('Atom\Renderer\Feed') instead. See https://www.drupal.org/node/2979042
  feed.writer.contentrendererentry:
    class: Laminas\Feed\Writer\Extension\Content\Renderer\Entry
    shared: false
    deprecated: The "%service_id%" service is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. You should use \Drupal::service('feed.bridge.writer')->get('Content\Renderer\Entry') instead. See https://www.drupal.org/node/2979042
  feed.writer.dublincorerendererentry:
    class: Laminas\Feed\Writer\Extension\DublinCore\Renderer\Entry
    shared: false
    deprecated: The "%service_id%" service is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. You should use \Drupal::service('feed.bridge.writer')->get('DublinCore\Renderer\Entry') instead. See https://www.drupal.org/node/2979042
  feed.writer.dublincorerendererfeed:
    class: Laminas\Feed\Writer\Extension\DublinCore\Renderer\Feed
    shared: false
    deprecated: The "%service_id%" service is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. You should use \Drupal::service('feed.bridge.writer')->get('DublinCore\Renderer\Feed') instead. See https://www.drupal.org/node/2979042
  feed.writer.itunesentry:
    class: Laminas\Feed\Writer\Extension\ITunes\Entry
    shared: false
    deprecated: The "%service_id%" service is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. You should use \Drupal::service('feed.bridge.writer')->get('ITunes\Entry') instead. See https://www.drupal.org/node/2979042
  feed.writer.itunesfeed:
    class: Laminas\Feed\Writer\Extension\ITunes\Feed
    shared: false
    deprecated: The "%service_id%" service is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. You should use \Drupal::service('feed.bridge.writer')->get('ITunes\Feed') instead. See https://www.drupal.org/node/2979042
  feed.writer.itunesrendererentry:
    class: Laminas\Feed\Writer\Extension\ITunes\Renderer\Entry
    shared: false
    deprecated: The "%service_id%" service is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. You should use \Drupal::service('feed.bridge.writer')->get('ITunes\Renderer\Entry') instead. See https://www.drupal.org/node/2979042
  feed.writer.itunesrendererfeed:
    class: Laminas\Feed\Writer\Extension\ITunes\Renderer\Feed
    shared: false
    deprecated: The "%service_id%" service is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. You should use \Drupal::service('feed.bridge.writer')->get('ITunes\Renderer\Feed') instead. See https://www.drupal.org/node/2979042
  feed.writer.slashrendererentry:
    class: Laminas\Feed\Writer\Extension\Slash\Renderer\Entry
    shared: false
    deprecated: The "%service_id%" service is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. You should use \Drupal::service('feed.bridge.writer')->get('Slash\Renderer\Entry') instead. See https://www.drupal.org/node/2979042
  feed.writer.threadingrendererentry:
    class: Laminas\Feed\Writer\Extension\Threading\Renderer\Entry
    shared: false
    deprecated: The "%service_id%" service is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. You should use \Drupal::service('feed.bridge.writer')->get('Threading\Renderer\Entry') instead. See https://www.drupal.org/node/2979042
  feed.writer.wellformedwebrendererentry:
    class: Laminas\Feed\Writer\Extension\WellFormedWeb\Renderer\Entry
    shared: false
    deprecated: The "%service_id%" service is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. You should use \Drupal::service('feed.bridge.writer')->get('WellFormedWeb\Renderer\Entry') instead. See https://www.drupal.org/node/2979042
  theme.manager:
    class: Drupal\Core\Theme\ThemeManager
    arguments: ['%app.root%', '@theme.negotiator', '@theme.initialization', '@module_handler']
+0 −339

File deleted.

Preview size limit exceeded, changes collapsed.

+0 −12
Original line number Diff line number Diff line
The Drupal Bridge Component

Thanks for using this Drupal component.

You can participate in its development on Drupal.org, through our issue system:
https://www.drupal.org/project/issues/drupal

You can get the full Drupal repo here:
https://www.drupal.org/project/drupal/git-instructions

You can browse the full Drupal repo here:
https://git.drupalcode.org/project/drupal
+0 −18
Original line number Diff line number Diff line
HOW-TO: Test this Drupal component

In order to test this component, you'll need to get the entire Drupal repo and
run the tests there.

You'll find the tests under core/tests/Drupal/Tests/Component.

You can get the full Drupal repo here:
https://www.drupal.org/project/drupal/git-instructions

You can find more information about running PHPUnit tests with Drupal here:
https://www.drupal.org/node/2116263

Each component in the Drupal\Component namespace has its own annotated test
group. You can use this group to run only the tests for this component. Like
this:

$ ./vendor/bin/phpunit -c core --group Bridge
+0 −137
Original line number Diff line number Diff line
<?php

namespace Drupal\Component\Bridge;

use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Laminas\Feed\Reader\ExtensionManagerInterface as ReaderManagerInterface;
use Laminas\Feed\Writer\ExtensionManagerInterface as WriterManagerInterface;

@trigger_error(__NAMESPACE__ . '\ZfExtensionManagerSfContainer is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. The class has moved to \Drupal\aggregator\ZfExtensionManagerSfContainer. See https://www.drupal.org/node/3258656', E_USER_DEPRECATED);

/**
 * Defines a bridge between the Laminas service manager to Symfony container.
 *
 * @deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. The class has
 *   moved to \Drupal\aggregator\ZfExtensionManagerSfContainer.
 *
 * @see https://www.drupal.org/node/3258656
 */
class ZfExtensionManagerSfContainer implements ReaderManagerInterface, WriterManagerInterface, ContainerAwareInterface {

  /**
   * A map of characters to be replaced through strtr.
   *
   * This property is based on Laminas service manager.
   *
   * @link https://github.com/laminas/laminas-servicemanager for the canonical source repository
   * @copyright Copyright (c) 2019, Laminas Foundation. (https://getlaminas.org/)
   * @license https://github.com/laminas/laminas-servicemanager/blob/master/LICENSE.md
   *
   * @var array
   *
   * @see \Drupal\Component\Bridge\ZfExtensionManagerSfContainer::canonicalizeName().
   * @see https://github.com/laminas/laminas-servicemanager/blob/2.7.11/src/ServiceManager.php#L114
   */
  protected $canonicalNamesReplacements = ['-' => '', '_' => '', ' ' => '', '\\' => '', '/' => ''];

  /**
   * The prefix to be used when retrieving plugins from the container.
   *
   * @var string
   */
  protected $prefix = '';

  /**
   * The service container.
   *
   * @var \Symfony\Component\DependencyInjection\ContainerInterface
   */
  protected $container;

  /**
   * A local cache of computed canonical names.
   *
   * @var string[]
   */
  protected $canonicalNames;

  /**
   * @var \Laminas\Feed\Reader\ExtensionManagerInterface|\Laminas\Feed\Writer\ExtensionManagerInterface
   */
  protected $standalone;

  /**
   * Constructs a ZfExtensionManagerSfContainer object.
   *
   * @param string $prefix
   *   The prefix to be used when retrieving plugins from the container.
   */
  public function __construct($prefix = '') {
    $this->prefix = $prefix;
  }

  /**
   * {@inheritdoc}
   */
  public function get($extension) {
    if ($this->standalone && $this->standalone->has($extension)) {
      return $this->standalone->get($extension);
    }
    return $this->container->get($this->prefix . $this->canonicalizeName($extension));
  }

  /**
   * {@inheritdoc}
   */
  public function has($extension) {
    if ($this->standalone && $this->standalone->has($extension)) {
      return TRUE;
    }
    return $this->container->has($this->prefix . $this->canonicalizeName($extension));
  }

  /**
   * Canonicalize the extension name to a service name.
   *
   * This method is based on Laminas service manager.
   *
   * @link https://github.com/laminas/laminas-servicemanager for the canonical source repository
   * @copyright Copyright (c) 2019, Laminas Foundation. (https://getlaminas.org/)
   * @license https://github.com/laminas/laminas-servicemanager/blob/master/LICENSE.md
   *
   * @param string $name
   *   The extension name.
   *
   * @return string
   *   The service name, without the prefix.
   *
   * @see https://github.com/laminas/laminas-servicemanager/blob/2.7.11/src/ServiceManager.php#L900
   */
  protected function canonicalizeName($name) {
    if (isset($this->canonicalNames[$name])) {
      return $this->canonicalNames[$name];
    }
    // This is just for performance instead of using str_replace().
    return $this->canonicalNames[$name] = strtolower(strtr($name, $this->canonicalNamesReplacements));
  }

  /**
   * {@inheritdoc}
   */
  public function setContainer(ContainerInterface $container = NULL) {
    $this->container = $container;
  }

  /**
   * @param $class
   *   The class to set as standalone.
   */
  public function setStandalone($class) {
    if (!is_subclass_of($class, ReaderManagerInterface::class) && !is_subclass_of($class, WriterManagerInterface::class)) {
      throw new \RuntimeException("$class must implement Laminas\Feed\Reader\ExtensionManagerInterface or Laminas\Feed\Writer\ExtensionManagerInterface");
    }
    $this->standalone = new $class();
  }

}
Loading