I have an Exception somewhere in my service/ folder, and Symfony is trying to autowire it :
Cannot autowire service "App\Service\Order\Exception\StripeRequiresActionException": argument "$secretKey" of method "__construct()" is type-hinted "string", you should configure its value explicitly.
This is my class :
class StripeRequiresActionException extends \Exception
{
/**
* @var string
*/
protected $secretKey;
public function __construct(string $secretKey)
{
parent::__construct();
$this->secretKey = $secretKey;
}
/**
* @return string
*/
public function getSecretKey(): string
{
return $this->secretKey;
}
}
I don't want it to be autowired. Is there an easy way to prevent this class to be loaded by the DI, with an annotation for example? I know I can exclude this class in my yaml configuration, but I don't want to do that because I find this ugly and harder to maintain.