$this->
expectDeprecation('Since symfony/dependency-injection 6.3: Relying on the "@required" annotation on method "Symfony\Component\DependencyInjection\Tests\Compiler\SetterInjectionParentAnnotation::setDependencies()" is deprecated, use the "Symfony\Contracts\Service\Attribute\Required" attribute instead.'
);
$container =
new ContainerBuilder();
$container->
register(FooAnnotation::
class);
$container->
register(A::
class);
$container->
register(CollisionA::
class);
$container->
register(CollisionB::
class);
// manually configure *one* call, to override autowiring
$container ->
register('setter_injection', SetterInjectionAnnotation::
class) ->
setAutowired(true
) ->
addMethodCall('setWithCallsConfigured',
['manual_arg1', 'manual_arg2'
]);
(new ResolveClassPass())->
process($container);
(new AutowireRequiredMethodsPass())->
process($container);
$methodCalls =
$container->
getDefinition('setter_injection'
)->
getMethodCalls();
$this->
assertEquals( ['setWithCallsConfigured', 'setFoo', 'setChildMethodWithoutDocBlock', 'setDependencies'
],
array_column($methodCalls, 0
) );