Skip to content

Commit e2bdc6f

Browse files
committed
Merge branch '5.4' into 6.0
* 5.4: [Translation] Translate translatable parameters Implement Message Stream for Postmark Mailer Sort services in service locator according to priority Relax service locator tests. Allow any order [Serializer] Add support for collecting type error during denormalization
2 parents 7c2cc37 + 9a6ddc9 commit e2bdc6f

File tree

4 files changed

+20
-5
lines changed

4 files changed

+20
-5
lines changed

Compiler/ServiceLocatorTagPass.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ public static function register(ContainerBuilder $container, array $refMap, stri
102102
}
103103
$refMap[$id] = new ServiceClosureArgument($ref);
104104
}
105-
ksort($refMap);
106105

107106
$locator = (new Definition(ServiceLocator::class))
108107
->addArgument($refMap)

Loader/Configurator/ContainerConfigurator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,9 @@ function tagged_iterator(string $tag, string $indexAttribute = null, string $def
147147
/**
148148
* Creates a service locator by tag name.
149149
*/
150-
function tagged_locator(string $tag, string $indexAttribute = null, string $defaultIndexMethod = null): ServiceLocatorArgument
150+
function tagged_locator(string $tag, string $indexAttribute = null, string $defaultIndexMethod = null, string $defaultPriorityMethod = null): ServiceLocatorArgument
151151
{
152-
return new ServiceLocatorArgument(new TaggedIteratorArgument($tag, $indexAttribute, $defaultIndexMethod, true));
152+
return new ServiceLocatorArgument(new TaggedIteratorArgument($tag, $indexAttribute, $defaultIndexMethod, true, $defaultPriorityMethod));
153153
}
154154

155155
/**

Tests/Compiler/ServiceLocatorTagPassTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,22 @@ public function testIndexedByServiceIdWithDecoration()
177177
static::assertFalse($locator->has(Decorated::class));
178178
static::assertInstanceOf(Decorated::class, $locator->get(Service::class));
179179
}
180+
181+
public function testDefinitionOrderIsTheSame()
182+
{
183+
$container = new ContainerBuilder();
184+
$container->register('service-1');
185+
$container->register('service-2');
186+
187+
$locator = ServiceLocatorTagPass::register($container, [
188+
'service-2' => new Reference('service-2'),
189+
'service-1' => new Reference('service-1'),
190+
]);
191+
$locator = $container->getDefinition($locator);
192+
$factories = $locator->getArguments()[0];
193+
194+
static::assertSame(['service-2', 'service-1'], array_keys($factories));
195+
}
180196
}
181197

182198
class Locator

Tests/Fixtures/php/services_subscriber.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ public function isCompiled(): bool
4444
public function getRemovedIds(): array
4545
{
4646
return [
47-
'.service_locator.DlIAmAe' => true,
48-
'.service_locator.DlIAmAe.foo_service' => true,
4947
'.service_locator.t5IGRMW' => true,
48+
'.service_locator.zFfA7ng' => true,
49+
'.service_locator.zFfA7ng.foo_service' => true,
5050
'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition' => true,
5151
];
5252
}

0 commit comments

Comments
 (0)