diff --git a/Compiler/ServiceLocatorTagPass.php b/Compiler/ServiceLocatorTagPass.php index 728feb0bd..032e90509 100644 --- a/Compiler/ServiceLocatorTagPass.php +++ b/Compiler/ServiceLocatorTagPass.php @@ -131,7 +131,6 @@ public static function map(array $services): array $services[$k] = new ServiceClosureArgument($v); } - ksort($services); return $services; } diff --git a/Tests/Compiler/IntegrationTest.php b/Tests/Compiler/IntegrationTest.php index 8d74e8173..5e6beda14 100644 --- a/Tests/Compiler/IntegrationTest.php +++ b/Tests/Compiler/IntegrationTest.php @@ -619,7 +619,7 @@ public function testTaggedLocatorWithDefaultPriorityMethodConfiguredViaAttribute // We need to check priority of instances in the factories $factories = (new \ReflectionClass($locator))->getProperty('factories'); - self::assertSame([BarTagClass::class, FooTagClass::class], array_keys($factories->getValue($locator))); + self::assertSame([FooTagClass::class, BarTagClass::class], array_keys($factories->getValue($locator))); } public function testTaggedLocatorWithDefaultIndexMethodAndWithDefaultPriorityMethodConfiguredViaAttribute() @@ -648,7 +648,7 @@ public function testTaggedLocatorWithDefaultIndexMethodAndWithDefaultPriorityMet // We need to check priority of instances in the factories $factories = (new \ReflectionClass($locator))->getProperty('factories'); - self::assertSame(['bar_tag_class', 'foo_tag_class'], array_keys($factories->getValue($locator))); + self::assertSame(['foo_tag_class', 'bar_tag_class'], array_keys($factories->getValue($locator))); self::assertSame($container->get(BarTagClass::class), $locator->get('bar_tag_class')); self::assertSame($container->get(FooTagClass::class), $locator->get('foo_tag_class')); } diff --git a/Tests/Compiler/RegisterServiceSubscribersPassTest.php b/Tests/Compiler/RegisterServiceSubscribersPassTest.php index 9e1d60655..064f8f339 100644 --- a/Tests/Compiler/RegisterServiceSubscribersPassTest.php +++ b/Tests/Compiler/RegisterServiceSubscribersPassTest.php @@ -452,7 +452,7 @@ public static function getSubscribedServices(): array 'autowired' => new ServiceClosureArgument(new TypedReference('service.id', 'stdClass', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, 'autowired', [new Autowire(service: 'service.id')])), 'autowired.nullable' => new ServiceClosureArgument(new TypedReference('service.id', 'stdClass', ContainerInterface::IGNORE_ON_INVALID_REFERENCE, 'autowired.nullable', [new Autowire(service: 'service.id')])), 'autowired.parameter' => new ServiceClosureArgument('foobar'), - 'autowire.decorated' => new ServiceClosureArgument(new Reference('.service_locator.4qmCWv..inner', ContainerInterface::NULL_ON_INVALID_REFERENCE)), + 'autowire.decorated' => new ServiceClosureArgument(new Reference('.service_locator.PIYLhDv.inner', ContainerInterface::NULL_ON_INVALID_REFERENCE)), 'target' => new ServiceClosureArgument(new TypedReference('stdClass', 'stdClass', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, 'target', [new Target('someTarget')])), ]; $this->assertEquals($expected, $container->getDefinition((string) $locator->getFactory()[0])->getArgument(0)); diff --git a/Tests/Compiler/ServiceLocatorTagPassTest.php b/Tests/Compiler/ServiceLocatorTagPassTest.php index faeb74316..812b47c7a 100644 --- a/Tests/Compiler/ServiceLocatorTagPassTest.php +++ b/Tests/Compiler/ServiceLocatorTagPassTest.php @@ -214,7 +214,7 @@ public function testDefinitionOrderIsTheSame() $locator = $container->getDefinition($locator); $factories = $locator->getArguments()[0]; - static::assertSame(['service-1', 'service-2'], array_keys($factories)); + static::assertSame(['service-2', 'service-1'], array_keys($factories)); } public function testBindingsAreProcessed() diff --git a/Tests/Fixtures/php/services_subscriber.php b/Tests/Fixtures/php/services_subscriber.php index e0cc6382c..a1313528d 100644 --- a/Tests/Fixtures/php/services_subscriber.php +++ b/Tests/Fixtures/php/services_subscriber.php @@ -65,14 +65,14 @@ protected static function getTestServiceSubscriberService($container) protected static function getFooServiceService($container) { return $container->services['foo_service'] = new \Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber((new \Symfony\Component\DependencyInjection\Argument\ServiceLocator($container->getService ??= $container->getService(...), [ - 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition' => ['privates', 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition', 'getCustomDefinitionService', false], 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber' => ['services', 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber', 'getTestServiceSubscriberService', false], + 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition' => ['privates', 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition', 'getCustomDefinitionService', false], 'bar' => ['services', 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber', 'getTestServiceSubscriberService', false], 'baz' => ['privates', 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition', 'getCustomDefinitionService', false], 'late_alias' => ['services', 'late_alias', 'getLateAliasService', false], ], [ - 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition' => 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition', 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber' => 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestServiceSubscriber', + 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition' => 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition', 'bar' => 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition', 'baz' => 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\CustomDefinition', 'late_alias' => 'Symfony\\Component\\DependencyInjection\\Tests\\Fixtures\\TestDefinition1',