Refactor command classes to use specific interfaces

- Updated command classes to use specific interfaces for Kernel, Doctrine, PasswordHasher, Templating, and Mailer.
This commit is contained in:
Jeroen De Meerleer 2024-05-22 10:36:27 +02:00
parent 02a14ad587
commit cd5a80b33b
Signed by: JeroenED
GPG Key ID: 28CCCB8F62BFADD6
6 changed files with 13 additions and 14 deletions

View File

@ -18,8 +18,8 @@ use Symfony\Component\HttpKernel\KernelInterface;
#[AsCommand(name: 'webcron:cleanup', description: 'Cleanup runs')]
class CleanupCommand extends Command
{
protected $kernel;
protected $doctrine;
protected KernelInterface $kernel;
protected ManagerRegistry $doctrine;
public function __construct(KernelInterface $kernel, ManagerRegistry $doctrine)
{

View File

@ -16,8 +16,8 @@ use Symfony\Component\HttpKernel\KernelInterface;
#[AsCommand(name: 'webcron:daemon', description: 'The master script of Webcron Management')]
class DaemonCommand extends Command
{
protected $kernel;
protected $doctrine;
protected KernelInterface $kernel;
protected ManagerRegistry $doctrine;
public function __construct(KernelInterface $kernel, ManagerRegistry $doctrine)
{

View File

@ -19,9 +19,9 @@ use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;
#[AsCommand(name: 'webcron:demodata', description: 'Install demo data')]
class DemoInstallCommand extends Command
{
protected $kernel;
protected $doctrine;
protected $passwordHasher;
protected KernelInterface $kernel;
protected ManagerRegistry $doctrine;
protected UserPasswordHasherInterface $passwordHasher;
public function __construct(KernelInterface $kernel, ManagerRegistry $doctrine, UserPasswordHasherInterface $passwordHasher)
{

View File

@ -23,10 +23,10 @@ use Twig\Environment;
#[AsCommand(name: 'webcron:mail-failed-runs', description: 'Sends email about failed runs')]
class MailFailedRunsCommand extends Command
{
protected $kernel;
protected $doctrine;
protected $templating;
protected $mailer;
protected KernelInterface $kernel;
protected ManagerRegistry $doctrine;
protected Environment $templating;
protected MailerInterface $mailer;
public function __construct(KernelInterface $kernel, ManagerRegistry $doctrine, Environment $templating, MailerInterface $mailer)
{

View File

@ -14,8 +14,8 @@ use Symfony\Component\HttpKernel\KernelInterface;
#[AsCommand(name: 'webcron:run', description: 'Run a single cronjob')]
class RunCommand extends Command
{
protected $kernel;
protected $doctrine;
protected KernelInterface $kernel;
protected ManagerRegistry $doctrine;
public function __construct(KernelInterface $kernel, ManagerRegistry $doctrine)
{

View File

@ -25,7 +25,6 @@ use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;
#[AsCommand(name: 'webcron:user', description: 'User stuff')]
class UserCommand extends Command
{
protected static $defaultName = 'webcron:user';
protected KernelInterface $kernel;
protected ManagerRegistry $doctrine;
protected UserPasswordHasherInterface $passwordHasher;