Skip to content

?array $arguments = null, should be array|AMQPTable|null $arguments = null, #23

Open

Description

@DenuxPlays

Found in declare* Methods.

When using codeception amqp with the bunny implementation array results in an runtime error (because bunny also has a bug) and passing AMQPTable (which works after patching it) results in an PHP Type Error.

Here is the patch I used which works:

Index: src/Codeception/Module/AMQP.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/Codeception/Module/AMQP.php b/src/Codeception/Module/AMQP.php
--- a/src/Codeception/Module/AMQP.php
+++ b/src/Codeception/Module/AMQP.php	(date 1759839586848)
@@ -13,6 +13,7 @@
 use PhpAmqpLib\Connection\AMQPStreamConnection;
 use PhpAmqpLib\Exception\AMQPProtocolChannelException;
 use PhpAmqpLib\Message\AMQPMessage;
+use PhpAmqpLib\Wire\AMQPTable;
 
 /**
  * This module interacts with message broker software that implements
@@ -166,7 +167,7 @@
         bool $auto_delete = true,
         bool $internal = false,
         bool $nowait = false,
-        ?array $arguments = null,
+        array|AMQPTable|null $arguments = null,
         ?int $ticket = null
     ) {
         return $this->getChannel()->exchange_declare(
@@ -203,7 +204,7 @@
         bool $exclusive = false,
         bool $auto_delete = true,
         bool $nowait = false,
-        ?array $arguments = null,
+        array|AMQPTable|null $arguments = null,
         ?int $ticket = null
     ): ?array {
         return $this->getChannel()->queue_declare(
@@ -239,7 +240,7 @@
         string $exchange,
         string $routing_key = '',
         bool $nowait = false,
-        ?array $arguments = null,
+        array|AMQPTable|null $arguments = null,
         ?int $ticket = null
     ) {
         return $this->getChannel()->queue_bind(

Activity

  1. W0rma commented on Dec 5, 2025

    @W0rma
    Contributor

    The requested change makes sense to me since php-amqplib/php-amqplib does allow AMQPTable as well.

    @DenuxPlays Do you plan to work on a PR?

  2. DenuxPlays commented on Dec 5, 2025

    @DenuxPlays
    Author

    Created one: #25

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions