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 934 -14
============================================
- Hits 935 921 -14
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.
| /** @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.
…into divide-queue-and-channel-names
| 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.
| 'Adapter must implement "%s". For queueName "%s" got "%s" instead.', | |
| 'Adapter must implement "%s". For queue "%s" got "%s" instead.', |
| /** | ||
| * @param QueueInterface $baseQueue Base queue for queues creation. | ||
| * @param array $definitions Adapter definitions indexed by channel names. | ||
| * @param array $definitions Adapter definitions indexed by queueName names. |
There was a problem hiding this comment.
| * @param array $definitions Adapter definitions indexed by queueName names. | |
| * @param array $definitions Adapter definitions indexed by queue names. |
| public function __construct(string|BackedEnum $channel = 'yii-queue') { | ||
| $this->channel = StringNormalizer::normalize($channel); | ||
| } |
There was a problem hiding this comment.
StringNormalizer::normalize() is for queue based on the variable names there but here you pass channel name to it (or is it queue name in fact?).
There was a problem hiding this comment.
It normalizes string|BackedEnum to just string. It's not for queues only.
There was a problem hiding this comment.
Then why is its signature public static function normalize(string|BackedEnum $queueName): string? Should be $name, not $queueName.
| @@ -20,10 +20,10 @@ public static function dataBase(): iterable | |||
| #[DataProvider('dataBase')] | |||
| public function testBase(string $expectedChannel, mixed $channel): void | |||
Uh oh!
There was an error while loading. Please reload this page.