From a5826e68641432729f6ad6e42c4b6da9d379f81a Mon Sep 17 00:00:00 2001 From: Alex Pott <alex.a.pott@googlemail.com> Date: Sun, 17 Mar 2024 10:56:54 +0000 Subject: [PATCH] Issue #3416826 by longwave, catch, smustgrave, solideogloria, fgm: Queue factory services do not conform to an interface --- .../Core/Queue/QueueDatabaseFactory.php | 14 ++++--------- .../Core/Queue/QueueFactoryInterface.php | 21 +++++++++++++++++++ 2 files changed, 25 insertions(+), 10 deletions(-) create mode 100644 core/lib/Drupal/Core/Queue/QueueFactoryInterface.php diff --git a/core/lib/Drupal/Core/Queue/QueueDatabaseFactory.php b/core/lib/Drupal/Core/Queue/QueueDatabaseFactory.php index c4e5b3ba1337..45d32f09efb8 100644 --- a/core/lib/Drupal/Core/Queue/QueueDatabaseFactory.php +++ b/core/lib/Drupal/Core/Queue/QueueDatabaseFactory.php @@ -5,9 +5,9 @@ use Drupal\Core\Database\Connection; /** - * Defines the key/value store factory for the database backend. + * Defines the queue factory for the database backend. */ -class QueueDatabaseFactory { +class QueueDatabaseFactory implements QueueFactoryInterface { /** * The database connection. @@ -20,20 +20,14 @@ class QueueDatabaseFactory { * Constructs this factory object. * * @param \Drupal\Core\Database\Connection $connection - * The Connection object containing the key-value tables. + * The Connection object containing the queue table. */ public function __construct(Connection $connection) { $this->connection = $connection; } /** - * Constructs a new queue object for a given name. - * - * @param string $name - * The name of the collection holding key and value pairs. - * - * @return \Drupal\Core\Queue\DatabaseQueue - * A key/value store implementation for the given $collection. + * {@inheritdoc} */ public function get($name) { return new DatabaseQueue($name, $this->connection); diff --git a/core/lib/Drupal/Core/Queue/QueueFactoryInterface.php b/core/lib/Drupal/Core/Queue/QueueFactoryInterface.php new file mode 100644 index 000000000000..580d958ee879 --- /dev/null +++ b/core/lib/Drupal/Core/Queue/QueueFactoryInterface.php @@ -0,0 +1,21 @@ +<?php + +namespace Drupal\Core\Queue; + +/** + * An interface defining queue factory classes. + */ +interface QueueFactoryInterface { + + /** + * Constructs a new queue object for a given name. + * + * @param string $name + * The name of the queue. + * + * @return \Drupal\Core\Queue\QueueInterface + * The queue object. + */ + public function get($name); + +} -- GitLab