`?array $arguments = null,` should be `array|AMQPTable|null $arguments = null,`

Open
#23 2 comments 0 reactions 0 assignees View on GitHub

@DenuxPlays is already working on this.

Since Dec 5, 2025.

  • #25 by @DenuxPlays — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
58/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
php

Research direction

Start in src/Codeception/Module/AMQP.php and inspect the exchange_declare, queue_declare, and queue_bind method signatures. Compare their arguments handling with the supplied patch, including the AMQPTable import. Done means these methods accept array, AMQPTable, or null without the reported PHP type error.

Written by the indexing model from the issue text.

Description

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(

Dominant language
PHP
Stars
4
Forks
9
Avg merge
1m
Merged PRs (30d)
1

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Codeception/module-amqp

All issues in Codeception/module-amqp

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.