diff --git a/src/DI/Helpers/ExchangesHelper.php b/src/DI/Helpers/ExchangesHelper.php index cc8bc36..7ebccdb 100644 --- a/src/DI/Helpers/ExchangesHelper.php +++ b/src/DI/Helpers/ExchangesHelper.php @@ -15,8 +15,7 @@ final class ExchangesHelper extends AbstractHelper { - public const EXCHANGE_TYPES = ['direct', 'topic', 'headers', 'fanout']; - //public const CREATE_TYPES = [0 => false, 1 => true, 2 => 'lazy']; + public const EXCHANGE_TYPES = ['direct', 'topic', 'headers', 'fanout', 'x-delayed-message']; public function getConfigSchema(): Schema { diff --git a/src/DI/RabbitMQExtension.php b/src/DI/RabbitMQExtension.php index a4264de..6998402 100644 --- a/src/DI/RabbitMQExtension.php +++ b/src/DI/RabbitMQExtension.php @@ -18,8 +18,8 @@ use Nette\DI\CompilerExtension; use Nette\DI\Definitions\Statement; use Nette\DI\PhpGenerator; +use Nette\PhpGenerator\Literal; use Nette\PhpGenerator\PhpLiteral; -use Nette\PhpGenerator\Closure; use Nette\Schema\Expect; use Nette\Schema\Schema; @@ -108,7 +108,12 @@ protected function processConfig(PhpGenerator $generator, mixed &$item): void $this->processConfig($generator, $value); } } elseif ($item instanceof Statement) { - $item = new PhpLiteral($generator->formatStatement($item)); + if (class_exists(Literal::class)) { + $item = new Literal($generator->formatStatement($item)); + } else { + /** @psalm-suppress DeprecatedClass */ + $item = new PhpLiteral($generator->formatStatement($item)); + } } } } diff --git a/src/Exchange/ExchangeDeclarator.php b/src/Exchange/ExchangeDeclarator.php index 1c39055..960b148 100644 --- a/src/Exchange/ExchangeDeclarator.php +++ b/src/Exchange/ExchangeDeclarator.php @@ -67,7 +67,7 @@ public function declareExchange(string $name): void $federation['policy'] ); } catch (\RuntimeException $e) { - throw new ExchangeFactoryException("Failed to create federated exchange [$name]", $e->getCode(), $e); + throw new ExchangeFactoryException("Failed to create federated exchange [$name]", (int) $e->getCode(), $e); } } }