diff --git a/config/params.php b/config/params.php index 086f8f70..2195a8cb 100644 --- a/config/params.php +++ b/config/params.php @@ -10,7 +10,6 @@ use Yiisoft\Queue\Debug\QueueProviderInterfaceProxy; use Yiisoft\Queue\Debug\QueueWorkerInterfaceProxy; use Yiisoft\Queue\Provider\QueueProviderInterface; -use Yiisoft\Queue\QueueInterface; use Yiisoft\Queue\Worker\WorkerInterface; return [ @@ -24,7 +23,7 @@ 'yiisoft/queue' => [ 'handlers' => [], 'channels' => [ - QueueInterface::DEFAULT_CHANNEL => AdapterInterface::class, + QueueProviderInterface::DEFAULT_CHANNEL => AdapterInterface::class, ], 'middlewares-push' => [], 'middlewares-consume' => [], diff --git a/src/Adapter/SynchronousAdapter.php b/src/Adapter/SynchronousAdapter.php index 26789295..c92e95a8 100644 --- a/src/Adapter/SynchronousAdapter.php +++ b/src/Adapter/SynchronousAdapter.php @@ -9,6 +9,7 @@ use Yiisoft\Queue\ChannelNormalizer; use Yiisoft\Queue\JobStatus; use Yiisoft\Queue\Message\MessageInterface; +use Yiisoft\Queue\Provider\QueueProviderInterface; use Yiisoft\Queue\QueueInterface; use Yiisoft\Queue\Worker\WorkerInterface; use Yiisoft\Queue\Message\IdEnvelope; @@ -22,7 +23,7 @@ final class SynchronousAdapter implements AdapterInterface public function __construct( private readonly WorkerInterface $worker, private readonly QueueInterface $queue, - string|BackedEnum $channel = QueueInterface::DEFAULT_CHANNEL, + string|BackedEnum $channel = QueueProviderInterface::DEFAULT_CHANNEL, ) { $this->channel = ChannelNormalizer::normalize($channel); } diff --git a/src/Command/ListenCommand.php b/src/Command/ListenCommand.php index 3207385f..a025b8fd 100644 --- a/src/Command/ListenCommand.php +++ b/src/Command/ListenCommand.php @@ -10,7 +10,6 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Yiisoft\Queue\Provider\QueueProviderInterface; -use Yiisoft\Queue\QueueInterface; #[AsCommand( 'queue:listen', @@ -30,7 +29,7 @@ public function configure(): void 'channel', InputArgument::OPTIONAL, 'Queue channel name to connect to', - QueueInterface::DEFAULT_CHANNEL, + QueueProviderInterface::DEFAULT_CHANNEL, ); } diff --git a/src/Provider/QueueProviderInterface.php b/src/Provider/QueueProviderInterface.php index d833a84b..2655b17a 100644 --- a/src/Provider/QueueProviderInterface.php +++ b/src/Provider/QueueProviderInterface.php @@ -12,6 +12,9 @@ */ interface QueueProviderInterface { + /** @psalm-suppress MissingClassConstType */ + public const DEFAULT_CHANNEL = 'yii-queue'; + /** * Find a queue by channel name and returns it. * diff --git a/src/QueueInterface.php b/src/QueueInterface.php index f31d36c0..1985c32e 100644 --- a/src/QueueInterface.php +++ b/src/QueueInterface.php @@ -11,9 +11,6 @@ interface QueueInterface { - /** @psalm-suppress MissingClassConstType */ - public const DEFAULT_CHANNEL = 'yii-queue'; - /** * Pushes a message into the queue. * diff --git a/stubs/StubAdapter.php b/stubs/StubAdapter.php index 98cf273f..e7332e2d 100644 --- a/stubs/StubAdapter.php +++ b/stubs/StubAdapter.php @@ -9,7 +9,7 @@ use Yiisoft\Queue\ChannelNormalizer; use Yiisoft\Queue\JobStatus; use Yiisoft\Queue\Message\MessageInterface; -use Yiisoft\Queue\QueueInterface; +use Yiisoft\Queue\Provider\QueueProviderInterface; /** * Stub adapter that does nothing. Job status is always "done". @@ -19,7 +19,7 @@ final class StubAdapter implements AdapterInterface private string $channel; public function __construct( - string|BackedEnum $channel = QueueInterface::DEFAULT_CHANNEL + string|BackedEnum $channel = QueueProviderInterface::DEFAULT_CHANNEL ) { $this->channel = ChannelNormalizer::normalize($channel); } diff --git a/tests/Unit/Adapter/SynchronousAdapterTest.php b/tests/Unit/Adapter/SynchronousAdapterTest.php index 7d2758ce..acdce04d 100644 --- a/tests/Unit/Adapter/SynchronousAdapterTest.php +++ b/tests/Unit/Adapter/SynchronousAdapterTest.php @@ -10,7 +10,7 @@ use Yiisoft\Queue\JobStatus; use Yiisoft\Queue\Message\IdEnvelope; use Yiisoft\Queue\Message\Message; -use Yiisoft\Queue\QueueInterface; +use Yiisoft\Queue\Provider\QueueProviderInterface; use Yiisoft\Queue\Stubs\StubQueue; use Yiisoft\Queue\Stubs\StubWorker; use Yiisoft\Queue\Tests\TestCase; @@ -58,7 +58,7 @@ public function testIdSetting(): void public function testWithSameChannel(): void { $adapter = $this->getAdapter(); - self::assertEquals($adapter, $adapter->withChannel(QueueInterface::DEFAULT_CHANNEL)); + self::assertEquals($adapter, $adapter->withChannel(QueueProviderInterface::DEFAULT_CHANNEL)); } public function testWithAnotherChannel(): void