Skip to content

Fix compiler pass #639

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 16, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"ext-mongodb": "^1.3",
"ext-rdkafka": "^3.0.3",

"queue-interop/amqp-interop": "0.8.x-dev",
"queue-interop/queue-interop": "0.7.x-dev",
"queue-interop/amqp-interop": "^0.8",
"queue-interop/queue-interop": "^0.7",
"bunny/bunny": "^0.2.4|^0.3|^0.4",
"php-amqplib/php-amqplib": "^2.7",
"doctrine/dbal": "~2.5",
Expand All @@ -38,7 +38,7 @@
"require-dev": {
"phpunit/phpunit": "^5.5",
"phpstan/phpstan": "^0.10",
"queue-interop/queue-spec": "0.6.x-dev",
"queue-interop/queue-spec": "^0.6",
"symfony/browser-kit": "4.0.*",
"symfony/config": "4.0.*",
"symfony/process": "4.0.*",
Expand Down
6 changes: 3 additions & 3 deletions pkg/amqp-bunny/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
"license": "MIT",
"require": {
"php": "^7.1.3",
"queue-interop/amqp-interop": "0.8.x-dev",
"queue-interop/queue-interop": "0.7.x-dev",
"queue-interop/amqp-interop": "^0.8",
"queue-interop/queue-interop": "^0.7",
"bunny/bunny": "^0.2.4|^0.3|^0.4",
"enqueue/amqp-tools": "0.9.x-dev"
},
"require-dev": {
"phpunit/phpunit": "~5.4.0",
"enqueue/test": "0.9.x-dev",
"enqueue/null": "0.9.x-dev",
"queue-interop/queue-spec": "0.6.x-dev"
"queue-interop/queue-spec": "^0.6"
},
"support": {
"email": "[email protected]",
Expand Down
6 changes: 3 additions & 3 deletions pkg/amqp-ext/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
"require": {
"php": "^7.1.3",
"ext-amqp": "^1.9.3",
"queue-interop/amqp-interop": "0.8.x-dev",
"queue-interop/queue-interop": "0.7.x-dev",
"queue-interop/amqp-interop": "^0.8",
"queue-interop/queue-interop": "^0.7",
"enqueue/amqp-tools": "0.9.x-dev"
},
"require-dev": {
"phpunit/phpunit": "~5.4.0",
"enqueue/test": "0.9.x-dev",
"enqueue/null": "0.9.x-dev",
"queue-interop/queue-spec": "0.6.x-dev",
"queue-interop/queue-spec": "^0.6",
"empi89/php-amqp-stubs": "*@dev"
},
"support": {
Expand Down
4 changes: 2 additions & 2 deletions pkg/amqp-lib/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
"require": {
"php": "^7.1.3",
"php-amqplib/php-amqplib": "^2.7",
"queue-interop/amqp-interop": "0.8.x-dev",
"queue-interop/amqp-interop": "^0.8",
"enqueue/amqp-tools": "0.9.x-dev"
},
"require-dev": {
"phpunit/phpunit": "~5.4.0",
"enqueue/test": "0.9.x-dev",
"enqueue/null": "0.9.x-dev",
"queue-interop/queue-spec": "0.6.x-dev"
"queue-interop/queue-spec": "^0.6"
},
"support": {
"email": "[email protected]",
Expand Down
4 changes: 2 additions & 2 deletions pkg/amqp-tools/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"license": "MIT",
"require": {
"php": "^7.1.3",
"queue-interop/amqp-interop": "0.8.x-dev",
"queue-interop/queue-interop": "0.7.x-dev"
"queue-interop/amqp-interop": "^0.8",
"queue-interop/queue-interop": "^0.7"
},
"require-dev": {
"phpunit/phpunit": "~5.4.0",
Expand Down
2 changes: 1 addition & 1 deletion pkg/async-command/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"require": {
"php": ">=7.1",
"enqueue/enqueue": "0.9.x-dev",
"queue-interop/queue-interop": "0.7.x-dev",
"queue-interop/queue-interop": "^0.7",
"symfony/console": "^3.4|^4",
"symfony/process": "^3.4|^4"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ public function process(ContainerBuilder $container): void
return;
}

$defaultClient = $container->getParameter('enqueue.default_client');

$registeredToEvent = [];
foreach ($container->findTaggedServiceIds('kernel.event_listener') as $serviceId => $tagAttributes) {
foreach ($tagAttributes as $tagAttribute) {
Expand All @@ -44,7 +46,7 @@ public function process(ContainerBuilder $container): void
$container->getDefinition('enqueue.events.async_processor')
->addTag('enqueue.processor', [
'topic' => 'event.'.$event,
'client' => 'default',
'client' => $defaultClient,
])
;

Expand Down Expand Up @@ -78,7 +80,7 @@ public function process(ContainerBuilder $container): void
$container->getDefinition('enqueue.events.async_processor')
->addTag('enqueue.processor', [
'topicName' => 'event.'.$event,
'client' => 'default',
'client' => $defaultClient,
])
;

Expand Down
2 changes: 1 addition & 1 deletion pkg/async-event-dispatcher/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"require": {
"php": "^7.1.3",
"enqueue/enqueue": "0.9.x-dev",
"queue-interop/queue-interop": "0.7.x-dev",
"queue-interop/queue-interop": "^0.7",
"symfony/event-dispatcher": "^3.4|^4"
},
"require-dev": {
Expand Down
4 changes: 2 additions & 2 deletions pkg/dbal/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
"license": "MIT",
"require": {
"php": "^7.1.3",
"queue-interop/queue-interop": "0.7.x-dev",
"queue-interop/queue-interop": "^0.7",
"doctrine/dbal": "~2.5",
"ramsey/uuid": "^3"
},
"require-dev": {
"phpunit/phpunit": "~5.4.0",
"enqueue/test": "0.9.x-dev",
"enqueue/null": "0.9.x-dev",
"queue-interop/queue-spec": "0.6.x-dev"
"queue-interop/queue-spec": "^0.6"
},
"support": {
"email": "[email protected]",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function load(array $configs, ContainerBuilder $container): void
}

// or with name 'default'
if ('default' === $name) {
if (DiUtils::DEFAULT_CONFIG === $name) {
$defaultName = $name;
}
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/enqueue-bundle/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"require": {
"php": "^7.1.3",
"symfony/framework-bundle": "^3.4|^4",
"queue-interop/amqp-interop": "0.8.x-dev",
"queue-interop/queue-interop": "0.7.x-dev",
"queue-interop/amqp-interop": "^0.8",
"queue-interop/queue-interop": "^0.7",
"enqueue/enqueue": "0.9.x-dev",
"enqueue/null": "0.9.x-dev"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@
namespace Enqueue\Symfony\Client\DependencyInjection;

use Enqueue\Client\RouteCollection;
use Enqueue\Symfony\DiUtils;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;

final class AnalyzeRouteCollectionPass implements CompilerPassInterface
{
use FormatClientNameTrait;

protected $name;

public function process(ContainerBuilder $container): void
{
if (false == $container->hasParameter('enqueue.clients')) {
Expand All @@ -21,8 +18,9 @@ public function process(ContainerBuilder $container): void
$names = $container->getParameter('enqueue.clients');

foreach ($names as $name) {
$this->name = $name;
$routeCollectionId = $this->format('route_collection');
$diUtils = DiUtils::create(ClientFactory::MODULE, $name);

$routeCollectionId = $diUtils->format('route_collection');
if (false == $container->hasDefinition($routeCollectionId)) {
throw new \LogicException(sprintf('Service "%s" not found', $routeCollectionId));
}
Expand All @@ -36,11 +34,6 @@ public function process(ContainerBuilder $container): void
}
}

protected function getName(): string
{
return $this->name;
}

private function exclusiveCommandsCouldNotBeRunOnDefaultQueue(RouteCollection $collection): void
{
foreach ($collection->all() as $route) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,26 @@

namespace Enqueue\Symfony\Client\DependencyInjection;

use Enqueue\Symfony\DiUtils;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;

final class BuildClientExtensionsPass implements CompilerPassInterface
{
use FormatClientNameTrait;

protected $name;

public function process(ContainerBuilder $container): void
{
if (false == $container->hasParameter('enqueue.clients')) {
throw new \LogicException('The "enqueue.clients" parameter must be set.');
}

$names = $container->getParameter('enqueue.clients');
$defaultName = $container->getParameter('enqueue.default_client');

foreach ($names as $name) {
$this->name = $name;
$extensionsId = $this->format('client_extensions');
$diUtils = DiUtils::create(ClientFactory::MODULE, $name);

$extensionsId = $diUtils->format('client_extensions');
if (false == $container->hasDefinition($extensionsId)) {
throw new \LogicException(sprintf('Service "%s" not found', $extensionsId));
}
Expand All @@ -35,9 +34,9 @@ public function process(ContainerBuilder $container): void
$groupByPriority = [];
foreach ($tags as $serviceId => $tagAttributes) {
foreach ($tagAttributes as $tagAttribute) {
$client = $tagAttribute['client'] ?? 'default';
$client = $tagAttribute['client'] ?? $defaultName;

if ($client !== $this->name && 'all' !== $client) {
if ($client !== $name && 'all' !== $client) {
continue;
}

Expand All @@ -61,9 +60,4 @@ public function process(ContainerBuilder $container): void
));
}
}

protected function getName(): string
{
return $this->name;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,24 @@
use Enqueue\Client\CommandSubscriberInterface;
use Enqueue\Client\Route;
use Enqueue\Client\RouteCollection;
use Enqueue\Symfony\DiUtils;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;

final class BuildCommandSubscriberRoutesPass implements CompilerPassInterface
{
use FormatClientNameTrait;

protected $name;

public function process(ContainerBuilder $container): void
{
if (false == $container->hasParameter('enqueue.clients')) {
throw new \LogicException('The "enqueue.clients" parameter must be set.');
}

$names = $container->getParameter('enqueue.clients');
$defaultName = $container->getParameter('enqueue.default_client');

foreach ($names as $name) {
$this->name = $name;
$routeCollectionId = sprintf('enqueue.client.%s.route_collection', $this->name);
$diUtils = DiUtils::create(ClientFactory::MODULE, $name);
$routeCollectionId = $diUtils->format('route_collection');
if (false == $container->hasDefinition($routeCollectionId)) {
throw new \LogicException(sprintf('Service "%s" not found', $routeCollectionId));
}
Expand All @@ -47,9 +45,9 @@ public function process(ContainerBuilder $container): void
}

foreach ($tagAttributes as $tagAttribute) {
$client = $tagAttribute['client'] ?? 'default';
$client = $tagAttribute['client'] ?? $defaultName;

if ($client !== $this->name && 'all' !== $client) {
if ($client !== $name && 'all' !== $client) {
continue;
}

Expand Down Expand Up @@ -103,9 +101,4 @@ public function process(ContainerBuilder $container): void
));
}
}

protected function getName(): string
{
return $this->name;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,26 @@

namespace Enqueue\Symfony\Client\DependencyInjection;

use Enqueue\Symfony\DiUtils;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;

final class BuildConsumptionExtensionsPass implements CompilerPassInterface
{
use FormatClientNameTrait;

protected $name;

public function process(ContainerBuilder $container): void
{
if (false == $container->hasParameter('enqueue.clients')) {
throw new \LogicException('The "enqueue.clients" parameter must be set.');
}

$names = $container->getParameter('enqueue.clients');
$defaultName = $container->getParameter('enqueue.default_client');

foreach ($names as $name) {
$this->name = $name;
$diUtils = DiUtils::create(ClientFactory::MODULE, $name);

$extensionsId = $this->format('consumption_extensions');
$extensionsId = $diUtils->format('consumption_extensions');
if (false == $container->hasDefinition($extensionsId)) {
throw new \LogicException(sprintf('Service "%s" not found', $extensionsId));
}
Expand All @@ -36,9 +34,9 @@ public function process(ContainerBuilder $container): void
$groupByPriority = [];
foreach ($tags as $serviceId => $tagAttributes) {
foreach ($tagAttributes as $tagAttribute) {
$client = $tagAttribute['client'] ?? 'default';
$client = $tagAttribute['client'] ?? $defaultName;

if ($client !== $this->name && 'all' !== $client) {
if ($client !== $name && 'all' !== $client) {
continue;
}

Expand All @@ -62,9 +60,4 @@ public function process(ContainerBuilder $container): void
));
}
}

protected function getName(): string
{
return $this->name;
}
}
Loading