Open
Description
Context
I have a service where autowiring is disabled:
<?php
namespace App\Foo;
use Symfony\Component\DependencyInjection\Attribute\Autoconfigure;
#[Autoconfigure(autowiring: disabled)]
class Foo
{
// ...
}
because the services MUST not be injected automatically and the class must be instantiated manually. To do so, I decided to instantiate the class only through a static function and to use a private constructor.
Problem
When I add a Symfony\Component\HttpFoundation\Request
in a private constructor, I do have the following warning :
Symfony: You probably dont want to inject a "Request" here
I think this warning should be disabled when a private constructor is used.
Workaround I found
Put the service in a folder that is excluded from autowiring in config/services.yml
(this make the warning disappear but I think the PHP attribute should be processed too.
Metadata
Metadata
Assignees
Labels
No labels