Skip to content

Optimized the Hyperf\Amqp\Message\Message::getTypeString() method to prevent conflicts between property and getter methods.#7741

Merged
limingxinleo merged 2 commits into
hyperf:masterfrom
limingxinleo:v3.1-fix-7634
Apr 20, 2026
Merged

Optimized the Hyperf\Amqp\Message\Message::getTypeString() method to prevent conflicts between property and getter methods.#7741
limingxinleo merged 2 commits into
hyperf:masterfrom
limingxinleo:v3.1-fix-7634

Conversation

@limingxinleo
Copy link
Copy Markdown
Member

fix #7634

@limingxinleo limingxinleo requested a review from Copilot April 20, 2026 12:54
@limingxinleo limingxinleo merged commit c9d2ddf into hyperf:master Apr 20, 2026
62 checks passed
@limingxinleo limingxinleo deleted the v3.1-fix-7634 branch April 20, 2026 12:56
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses Hyperf issue #7634 by updating how AMQP message exchange types are converted to strings, ensuring delayed-exchange declarations respect overridden getType() implementations in subclasses.

Changes:

  • Updated Message::getTypeString() to derive the type via getType() instead of reading the $type property directly.
  • Added a changelog entry documenting the update in the 3.1 line.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/amqp/src/Message/Message.php Makes getTypeString() honor overridden getType() to avoid delayed-exchange type mismatches.
CHANGELOG-3.1.md Records the change for the upcoming 3.1.68 release notes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread CHANGELOG-3.1.md
Comment on lines 8 to +12

## Optimized

- [#7741](https://github.com/hyperf/hyperf/pull/7741) Optimized the `Hyperf\Amqp\Message\Message::getTypeString()` method to prevent conflicts between property and getter methods.

Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This entry describes a bug fix for #7634 (incorrect delayed exchange type), so it likely belongs under the "## Fixed" section rather than "## Optimized" to keep release notes consistent with the rest of the changelog.

Suggested change
## Optimized
- [#7741](https://github.com/hyperf/hyperf/pull/7741) Optimized the `Hyperf\Amqp\Message\Message::getTypeString()` method to prevent conflicts between property and getter methods.
- [#7741](https://github.com/hyperf/hyperf/pull/7741) Fixed bug that the `Hyperf\Amqp\Message\Message::getTypeString()` method may conflict between property and getter methods.

Copilot uses AI. Check for mistakes.
Comment on lines +41 to +42
$type = $this->getType();
return $type instanceof Type ? $type->value : $type;
Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are existing AMQP PHPUnit tests, but this behavior change (routing delayed exchange argument x-delayed-type now respecting overridden getType()) is not covered. Please add/adjust a test to assert that when a producer overrides getType() to return a different Type value, getTypeString() reflects it (and thus delayed exchange builder uses the expected string).

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] AMqp延迟队列生成的类型与配置的类型不匹配,设置FANOUT却生成的是Topic

2 participants