@@ -55,7 +55,7 @@ public function initialize(ExtensionManager $extensionManager): void
55
55
{
56
56
/** @var CrossContainerExtension|null $crossContainerExtension */
57
57
$ crossContainerExtension = $ extensionManager ->getExtension ('fob_cross_container ' );
58
- if (null !== $ crossContainerExtension ) {
58
+ if ($ crossContainerExtension !== null ) {
59
59
$ this ->crossContainerProcessor = $ crossContainerExtension ->getCrossContainerProcessor ();
60
60
}
61
61
}
@@ -83,7 +83,6 @@ public function load(ContainerBuilder $container, array $config): void
83
83
$ this ->loadContextRegistry ($ container );
84
84
$ this ->loadScenarioServiceContainer ($ container , $ config );
85
85
$ this ->loadEnvironmentHandler ($ container );
86
- $ this ->loadContextInitializers ($ container );
87
86
}
88
87
89
88
/**
@@ -94,15 +93,17 @@ public function process(ContainerBuilder $container): void
94
93
/** @var ContainerBuilder $scenarioContainer */
95
94
$ scenarioContainer = $ container ->get ('fob_context_service.service_container.scenario ' );
96
95
97
- if (null !== $ this ->crossContainerProcessor ) {
96
+ if ($ this ->crossContainerProcessor !== null ) {
98
97
$ this ->crossContainerProcessor ->process ($ scenarioContainer );
99
98
}
100
99
101
100
// This feature was introduced only in symfony/dependency-injection v3.3
102
101
// So we are adding the feature for modern containers and leaving as-is for older ones
103
102
if (method_exists ($ scenarioContainer , 'registerForAutoconfiguration ' )) {
104
- $ scenarioContainer ->registerForAutoconfiguration (\Behat \Behat \Context \Context::class)
105
- ->addTag (ContextRegistryPass::CONTEXT_SERVICE_TAG );
103
+ $ scenarioContainer
104
+ ->registerForAutoconfiguration (\Behat \Behat \Context \Context::class)
105
+ ->addTag (ContextRegistryPass::CONTEXT_SERVICE_TAG )
106
+ ;
106
107
}
107
108
108
109
$ scenarioContainer ->addCompilerPass (new ContextRegistryPass ($ container ->getDefinition ('fob_context_service.context_registry ' )));
@@ -146,20 +147,10 @@ private function loadEnvironmentHandler(ContainerBuilder $container): void
146
147
]);
147
148
$ definition ->addTag (EnvironmentExtension::HANDLER_TAG , ['priority ' => 128 ]);
148
149
149
- $ container ->setDefinition ('fob_context_service.environment_handler.context_service ' , $ definition );
150
- }
151
-
152
- /**
153
- * @param ContainerBuilder $container
154
- */
155
- private function loadContextInitializers (ContainerBuilder $ container )
156
- {
157
- $ references = $ container ->findTaggedServiceIds (ContextExtension::INITIALIZER_TAG );
158
-
159
- $ definition = $ container ->getDefinition ('fob_context_service.environment_handler.context_service ' );
160
-
161
- foreach ($ references as $ serviceId => $ tags ) {
150
+ foreach ($ container ->findTaggedServiceIds (ContextExtension::INITIALIZER_TAG ) as $ serviceId => $ tags ) {
162
151
$ definition ->addMethodCall ('registerContextInitializer ' , [$ container ->getDefinition ($ serviceId )]);
163
152
}
153
+
154
+ $ container ->setDefinition ('fob_context_service.environment_handler.context_service ' , $ definition );
164
155
}
165
156
}
0 commit comments