Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #259 +/- ##
============================================
- Coverage 98.62% 98.60% -0.03%
+ Complexity 356 351 -5
============================================
Files 47 46 -1
Lines 948 933 -15
============================================
- Hits 935 920 -15
Misses 13 13 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR separates logical queue names from adapter-specific channel configuration by removing channel-related methods from AdapterInterface and updating the queue/provider APIs accordingly (per #255). It updates config keys/CLI commands/tests to use queue names, and introduces a small normalizer utility for enum-backed queue names.
Changes:
- Remove
withChannel()/getChannel()fromAdapterInterface; introduce queue naming viaQueueInterface::getName()andQueueInterface::withAdapter(..., $queueName). - Replace
Channel*concepts withQueue*in providers/exceptions/config/CLI, and addQueueNameNormalizer. - Update stubs, debug tooling, and tests to align with the new queue-name API.
Reviewed changes
Copilot reviewed 41 out of 41 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Unit/WorkerTest.php | Switch failure pipeline lookup to use queue name (getName()). |
| tests/Unit/Stubs/StubQueueTest.php | Remove getChannel()-without-adapter test (API removed). |
| tests/Unit/QueueTest.php | Update queue naming expectations to getName() and new withAdapter() signature. |
| tests/Unit/Provider/QueueNotFoundExceptionTest.php | Rename exception test to queue-based concept and adjust assertions. |
| tests/Unit/Provider/PrototypeQueueProviderTest.php | Remove tests for deleted PrototypeQueueProvider. |
| tests/Unit/Provider/CompositeQueueProviderTest.php | Update provider tests to assert getName() and new exception class. |
| tests/Unit/Provider/AdapterFactoryQueueProviderTest.php | Update provider tests for queue names; add coverage for queue-name vs adapter-channel separation. |
| tests/Unit/Middleware/Push/MiddlewareDispatcherTest.php | Adjust middleware tests to work with removed adapter interface channel methods. |
| tests/Unit/Debug/QueueDecoratorTest.php | Update decorator test from getChannel() to getName(). |
| tests/Unit/Command/RunCommandTest.php | Expand/adjust command tests for queue-name arguments and output text. |
| tests/Unit/Command/ListenCommandTest.php | Update listen command tests for default/custom queue argument behavior. |
| tests/Unit/Adapter/SynchronousAdapterTest.php | Remove channel-related adapter tests after interface change. |
| tests/Integration/MiddlewareTest.php | Update integration wiring to include queue name and use getName(). |
| tests/Benchmark/Support/VoidAdapter.php | Remove withChannel() implementation from benchmark adapter (interface no longer requires it). |
| tests/Benchmark/QueueBench.php | Use named argument to pass adapter after constructor signature change. |
| tests/App/FakeAdapter.php | Update normalizer usage and adjust withChannel() return type to self. |
| tests/App/DummyQueue.php | Update queue naming ($name, getName()) and withAdapter() signature. |
| stubs/StubQueue.php | Add queue name state and support setting it via withAdapter(..., $queueName). |
| stubs/StubAdapter.php | Swap normalizer and default constant; keep adapter-local channel behavior for tests. |
| src/QueueNameNormalizer.php | New internal helper to normalize `string |
| src/QueueInterface.php | Introduce queue naming API (getName()) and update withAdapter() signature. |
| src/Queue.php | Store logical queue name; getName() returns it; withAdapter() can set it. |
| src/Provider/QueueProviderInterface.php | Rename defaults and API params from channel to queue name. |
| src/Provider/QueueNotFoundException.php | New exception replacing ChannelNotFoundException. |
| src/Provider/PrototypeQueueProvider.php | Remove provider that depended on adapter channel mutation. |
| src/Provider/CompositeQueueProvider.php | Use queue-name terminology and throw QueueNotFoundException. |
| src/Provider/ChannelNotFoundException.php | Remove channel-specific exception class. |
| src/Provider/AdapterFactoryQueueProvider.php | Create queues by setting queue name on queue rather than mutating adapter channel. |
| src/Middleware/FailureHandling/FailureMiddlewareDispatcher.php | Select failure middleware pipeline by queue name instead of channel. |
| src/Debug/QueueProviderInterfaceProxy.php | Update proxy method params from channel to queue name. |
| src/Debug/QueueDecorator.php | Collect debug info using queue name; update withAdapter() signature. |
| src/Debug/QueueCollector.php | Store pushes/processing messages keyed by queue name. |
| src/Command/RunCommand.php | Rename CLI argument to queue and adjust messages/options wording. |
| src/Command/ListenCommand.php | Rename CLI argument to queue and update default constant usage. |
| src/Command/ListenAllCommand.php | Rename CLI argument to queue and update help text. |
| src/ChannelNormalizer.php | Remove old channel normalizer (replaced by queue name normalizer). |
| src/Adapter/SynchronousAdapter.php | Remove channel state and channel-mutating methods. |
| src/Adapter/AdapterInterface.php | Remove channel-related methods from the adapter interface. |
| config/params.php | Rename config key channels → queues and default constant. |
| config/di.php | Wire providers/commands using the new queues params key. |
| README.md | Update adapter definition examples (but still needs further alignment with queue-name terminology/API). |
Comments suppressed due to low confidence (1)
tests/Unit/Provider/QueueNotFoundExceptionTest.php:28
- This test was loosened to
assertStringContainsString(), which may hide regressions in the exception message format. SinceQueueNotFoundExceptionhas a deterministic message, prefer asserting the full message (and consider renaming$expectedChannel/$channelto queue-oriented names for clarity).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| /** | ||
| * @param AdapterInterface $adapter Adapter to use. | ||
| * @param string|null $queueName Queue name to use. | ||
| * | ||
| * @return static A new queue with the given adapter and queue name. | ||
| */ | ||
| public function withAdapter(AdapterInterface $adapter, string|BackedEnum|null $queueName = null): static; |
There was a problem hiding this comment.
PHPDoc for withAdapter() says @param string|null $queueName, but the signature accepts string|BackedEnum|null. Update the docblock to include BackedEnum (and ensure wording matches the new queue-name concept).
| throw new InvalidQueueConfigException( | ||
| sprintf( | ||
| 'Adapter must implement "%s". For channel "%s" got "%s" instead.', | ||
| 'Adapter must implement "%s". For queueName "%s" got "%s" instead.', |
There was a problem hiding this comment.
The error message uses the term queueName (camelCase) in user-facing text: For queueName "%s" .... Consider changing it to a more readable phrase such as "For queue "%s"" or "For queue name "%s"" and update the related test expectation accordingly.
| 'Adapter must implement "%s". For queueName "%s" got "%s" instead.', | |
| 'Adapter must implement "%s". For queue "%s" got "%s" instead.', |
| /** @var StubQueue $mailQueue<StubAdapter> */ | ||
| $mailQueue = $provider->get('mail-queue'); | ||
| /** @var StubQueue $logQueue<StubAdapter> */ | ||
| $logQueue = $provider->get('log-queue'); |
There was a problem hiding this comment.
These PHPDoc annotations have invalid generic syntax: /** @var StubQueue $mailQueue<StubAdapter> */. For Psalm-style generics, the generic should be on the type, e.g. StubQueue<StubAdapter>, not appended to the variable name.
| [ | ||
| 'channel1' => new SynchronousAdapter(), | ||
| 'channel2' => static fn(SynchronousAdapter $adapter) => $adapter->withChannel('channel2'), | ||
| 'channel3' => [ | ||
| 'channel2' => new SynchronousAdapter(), // a second instance for a different queue processing pipeline | ||
| 'channel3' => [ // use a yiisoft/factory syntax for adapter creation | ||
| 'class' => SynchronousAdapter::class, | ||
| '__constructor' => ['channel' => 'channel3'], | ||
| ], |
There was a problem hiding this comment.
The adapter-definition example still uses channel1/channel2/channel3 keys and instantiates SynchronousAdapter without required constructor dependencies. Since this PR switches terminology to queue names and removes adapter channel configuration from the interface, this snippet should be updated to reflect the new API (queue names) and a realistic adapter construction/definition example.
Uh oh!
There was an error while loading. Please reload this page.