Skip to content

Conversation

@huangdijia
Copy link
Contributor

@huangdijia huangdijia commented Nov 14, 2025

Summary

This PR removes the unused PendingClosureDispatch class and consolidates functionality to use PendingAsyncQueueDispatch from the Support package.

Changes

Removed Files

  • src/async-queue-closure-job/src/PendingClosureDispatch.php - Unused wrapper class
  • tests/AsyncQueueClosureJob/PendingClosureDispatchTest.php - Dedicated test file
  • tests/AsyncQueueClosureJob/PendingClosureDispatchSimpleTest.php - Dedicated test file

Modified Files

Core Changes:

  • src/async-queue-closure-job/src/Functions.php - Updated dispatch() to return PendingAsyncQueueDispatch
  • src/support/src/Bus/PendingAsyncQueueDispatch.php - Added onConnection() alias for backward compatibility

Test Updates:

  • Updated all test files to use PendingAsyncQueueDispatch instead of PendingClosureDispatch
  • Fixed property references from connection to pool to match the actual property name

Documentation Updates:

  • Updated API references in all language versions (EN, ZH-CN, ZH-HK, ZH-TW)
  • Updated READMEs to reflect the new class name

Benefits

  • Reduces code duplication: Eliminates a redundant wrapper class
  • Maintains backward compatibility: Added onConnection() alias method
  • Simplifies maintenance: One less class to maintain
  • Same functionality: All existing features work identically

Test Results

All 59 tests pass with 172 assertions:

  • ✓ BasicFunctionalityTest (10 tests)
  • ✓ CallQueuedClosureCreateTest (11 tests)
  • ✓ ClosureJobTest (11 tests)
  • ✓ CoreFunctionalityTest (10 tests)
  • ✓ DispatchFunctionSimpleTest (6 tests)
  • ✓ DispatchFunctionTest (6 tests)
  • ✓ FluentDispatchIntegrationTest (5 tests)

Type analysis also passes with no errors.

Summary by CodeRabbit

发布说明

  • 突破性变更

    • 异步队列关闭作业 API 重命名:PendingClosureDispatch 改为 PendingAsyncQueueDispatch
    • 公共方法重命名:onConnection() 改为 onPool()
    • dispatch() 函数返回类型更新为新的 PendingAsyncQueueDispatch
  • 文档

    • 更新多语言文档以反映 API 变更
    • 在组件支持列表中添加异步队列关闭作业包

- Remove `PendingClosureDispatch` class in favor of `PendingAsyncQueueDispatch`
- Add `onConnection()` alias method to `PendingAsyncQueueDispatch` for backward compatibility
- Update all documentation to reference `PendingAsyncQueueDispatch`
- Update test files to use `PendingAsyncQueueDispatch` and correct property references
- Remove dedicated `PendingClosureDispatch` test files

This change simplifies the codebase by using the shared `PendingAsyncQueueDispatch`
class from the Support package, eliminating code duplication while maintaining
the same functionality and API compatibility.
@coderabbitai
Copy link

coderabbitai bot commented Nov 14, 2025

Warning

Rate limit exceeded

@huangdijia has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 11 minutes and 55 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 63b4176 and 196a80c.

📒 Files selected for processing (9)
  • docs/en/components/async-queue-closure-job.md (10 hunks)
  • docs/zh-cn/components/async-queue-closure-job.md (6 hunks)
  • docs/zh-hk/components/async-queue-closure-job.md (14 hunks)
  • docs/zh-tw/components/async-queue-closure-job.md (14 hunks)
  • tests/AsyncQueueClosureJob/CoreFunctionalityTest.php (0 hunks)
  • tests/AsyncQueueClosureJob/DispatchFunctionSimpleTest.php (0 hunks)
  • tests/AsyncQueueClosureJob/DispatchFunctionTest.php (0 hunks)
  • tests/AsyncQueueClosureJob/FluentDispatchIntegrationTest.php (0 hunks)
  • types/AsyncQueueClosureJob/Functions.php (1 hunks)

Walkthrough

该PR将异步队列分发API从 PendingClosureDispatch 重命名为 PendingAsyncQueueDispatch,并将方法 onConnection() 改为 onPool()。同时删除了原有类,更新了文档与测试代码以反映这些公共API的变更。

Changes

顺序 文件分组 / 文件 变更摘要
核心API实现
src/async-queue-closure-job/src/Functions.php
更新dispatch()的返回类型为PendingAsyncQueueDispatch,并添加对应的use导入
核心类变更
src/async-queue-closure-job/src/PendingClosureDispatch.php
删除PendingClosureDispatch类文件(该功能已迁移至PendingAsyncQueueDispatch)
文档更新(英文)
docs/en/components/async-queue-closure-job.md
更新API参考:PendingClosureDispatch→PendingAsyncQueueDispatch,onConnection()→onPool()
文档更新(简体中文)
docs/zh-cn/components/async-queue-closure-job.md,
src/async-queue-closure-job/README.zh-CN.md
更新API返回类型和方法引用,反映类型重命名和方法重命名
文档更新(繁体中文港澳)
docs/zh-hk/components/async-queue-closure-job.md,
docs/zh-hk/guide/start/components.md
更新API参考中的类型和方法名称;新增async-queue-closure-job组件表格条目
文档更新(繁体中文台湾)
docs/zh-tw/components/async-queue-closure-job.md,
docs/zh-tw/guide/start/components.md
更新文档术语和方法引用;新增组件支持表格条目
通用README
src/async-queue-closure-job/README.md
更新API参考中的dispatch返回类型文档
测试文件删除
tests/AsyncQueueClosureJob/PendingClosureDispatchTest.php,
tests/AsyncQueueClosureJob/PendingClosureDispatchSimpleTest.php
删除针对PendingClosureDispatch的测试文件
测试更新
tests/AsyncQueueClosureJob/BasicFunctionalityTest.php,
tests/AsyncQueueClosureJob/CoreFunctionalityTest.php,
tests/AsyncQueueClosureJob/DispatchFunctionSimpleTest.php,
tests/AsyncQueueClosureJob/DispatchFunctionTest.php,
tests/AsyncQueueClosureJob/FluentDispatchIntegrationTest.php
更新import、类型断言、方法调用和属性访问:PendingClosureDispatch→PendingAsyncQueueDispatch,onConnection()→onPool(),connection→pool

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

需要特别关注的区域:

  • src/async-queue-closure-job/src/Functions.php - 验证新类实例化和返回类型的正确性
  • src/async-queue-closure-job/src/PendingClosureDispatch.php - 确认该类确实已完全迁移至PendingAsyncQueueDispatch,无遗漏
  • 所有测试文件的pool属性更新 - 检查属性重命名是否在新类中正确实现
  • 文档跨多语言版本的一致性 - 确保中文、繁体字、英文文档术语统一

Possibly related PRs

Suggested reviewers

  • xuanyanwow
  • zds-s

Poem

🐰 调度器焕新颜,队列池名更清晰,
閉包任务展新姿,PendingAsync当道行,
文档齐飞多语言,测试驱动一路青!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 3.45% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR title accurately describes the main refactoring objective - removing the unused PendingClosureDispatch class and consolidating functionality to PendingAsyncQueueDispatch.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

The onConnection method was removed from PendingAsyncQueueDispatch in favor of using onPool directly. All test cases have been updated to replace onConnection calls with onPool to maintain consistency and avoid method duplication.
Replaces all instances of the onConnection method with onPool in async queue closure job documentation for consistency with the latest API usage.
Replaces references to `onConnection` with `onPool` in the Chinese documentation for consistency with the API. Adds formatting improvements to the English documentation for better readability.
Updated documentation to use the onPool method instead of onConnection for specifying queue connections, reflecting API changes and improving consistency in examples and method descriptions.
Replaces references and documentation for the onConnection method with onPool in all language versions. Clarifies that onPool sets the queue connection name and removes duplicate/alias documentation for consistency.
@huangdijia huangdijia merged commit 614f004 into main Nov 14, 2025
22 checks passed
@huangdijia huangdijia deleted the refactor/remove-pending-closure-dispatch branch November 14, 2025 13:36
huangdijia added a commit that referenced this pull request Nov 14, 2025
* refactor: remove unused PendingClosureDispatch class

- Remove `PendingClosureDispatch` class in favor of `PendingAsyncQueueDispatch`
- Add `onConnection()` alias method to `PendingAsyncQueueDispatch` for backward compatibility
- Update all documentation to reference `PendingAsyncQueueDispatch`
- Update test files to use `PendingAsyncQueueDispatch` and correct property references
- Remove dedicated `PendingClosureDispatch` test files

This change simplifies the codebase by using the shared `PendingAsyncQueueDispatch`
class from the Support package, eliminating code duplication while maintaining
the same functionality and API compatibility.

* Update docs and translate

* Remove onConnection method in PendingAsyncQueueDispatch

The onConnection method was removed from PendingAsyncQueueDispatch in favor of using onPool directly. All test cases have been updated to replace onConnection calls with onPool to maintain consistency and avoid method duplication.

* Update docs to use onPool instead of onConnection

Replaces all instances of the onConnection method with onPool in async queue closure job documentation for consistency with the latest API usage.

* Update async queue closure job docs for method naming

Replaces references to `onConnection` with `onPool` in the Chinese documentation for consistency with the API. Adds formatting improvements to the English documentation for better readability.

* Replace onConnection with onPool in async queue docs

Updated documentation to use the onPool method instead of onConnection for specifying queue connections, reflecting API changes and improving consistency in examples and method descriptions.

* Update docs and translate

* Update async queue job docs to use onPool method

Replaces references and documentation for the onConnection method with onPool in all language versions. Clarifies that onPool sets the queue connection name and removes duplicate/alias documentation for consistency.

* Update docs and translate

* 删除 AsyncQueueClosureJob 相关的测试文件以简化代码库

* 添加 AsyncQueueClosureJob 的功能测试,验证 dispatch 方法及其链式调用

---------

Co-Authored-By: Deeka Wong <8337659+huangdijia@users.noreply.github.com>
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.

2 participants