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
Changes from all commits
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
@@ -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",
@@ -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.*",
6 changes: 3 additions & 3 deletions pkg/amqp-bunny/composer.json
Original file line number Diff line number Diff line change
@@ -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]",
6 changes: 3 additions & 3 deletions pkg/amqp-ext/composer.json
Original file line number Diff line number Diff line change
@@ -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": {
4 changes: 2 additions & 2 deletions pkg/amqp-lib/composer.json
Original file line number Diff line number Diff line change
@@ -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]",
4 changes: 2 additions & 2 deletions pkg/amqp-tools/composer.json
Original file line number Diff line number Diff line change
@@ -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",
2 changes: 1 addition & 1 deletion pkg/async-command/composer.json
Original file line number Diff line number Diff line change
@@ -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"
},
Original file line number Diff line number Diff line change
@@ -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) {
@@ -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,
])
;

@@ -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,
])
;

2 changes: 1 addition & 1 deletion pkg/async-event-dispatcher/composer.json
Original file line number Diff line number Diff line change
@@ -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": {
4 changes: 2 additions & 2 deletions pkg/dbal/composer.json
Original file line number Diff line number Diff line change
@@ -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]",
Original file line number Diff line number Diff line change
@@ -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;
}
}
4 changes: 2 additions & 2 deletions pkg/enqueue-bundle/composer.json
Original file line number Diff line number Diff line change
@@ -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"
},
Original file line number Diff line number Diff line change
@@ -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')) {
@@ -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));
}
@@ -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) {
Original file line number Diff line number Diff line change
@@ -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));
}
@@ -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;
}

@@ -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
@@ -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));
}
@@ -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;
}

@@ -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
@@ -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));
}
@@ -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;
}

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

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