DX: apply rector rules up to php8.0

This commit is contained in:
2023-04-15 01:05:37 +02:00
parent d8870e906f
commit dde3002100
714 changed files with 2348 additions and 9263 deletions

View File

@@ -53,39 +53,23 @@ class ChillImportUsersCommand extends Command
protected bool $doChanges = true;
protected EntityManagerInterface $em;
protected array $groupCenters;
protected LoggerInterface $logger;
protected Writer $output;
protected UserPasswordEncoderInterface $passwordEncoder;
protected array $permissionGroups;
protected InputInterface $tempInput;
protected OutputInterface $tempOutput;
protected UserRepository $userRepository;
protected ValidatorInterface $validator;
public function __construct(
EntityManagerInterface $em,
LoggerInterface $logger,
UserPasswordEncoderInterface $passwordEncoder,
ValidatorInterface $validator,
UserRepository $userRepository
protected EntityManagerInterface $em,
protected LoggerInterface $logger,
protected UserPasswordEncoderInterface $passwordEncoder,
protected ValidatorInterface $validator,
protected UserRepository $userRepository
) {
$this->em = $em;
$this->passwordEncoder = $passwordEncoder;
$this->validator = $validator;
$this->logger = $logger;
$this->userRepository = $userRepository;
parent::__construct('chill:main:import-users');
}

View File

@@ -162,7 +162,7 @@ class ChillUserSendRenewPasswordCodeCommand extends Command
if (array_key_exists('email', $row)) {
return $userRepository->findOneByUsernameOrEmail(trim($row['email']));
}
} catch (\Doctrine\ORM\NoResultException $e) {
} catch (\Doctrine\ORM\NoResultException) {
// continue, we will try username
}
@@ -170,7 +170,7 @@ class ChillUserSendRenewPasswordCodeCommand extends Command
if (array_key_exists('username', $row)) {
return $userRepository->findOneByUsernameOrEmail(trim($row['username']));
}
} catch (\Doctrine\ORM\NoResultException $e) {
} catch (\Doctrine\ORM\NoResultException) {
return null;
}
}

View File

@@ -19,14 +19,10 @@ use Symfony\Component\Console\Output\OutputInterface;
class ExecuteCronJobCommand extends Command
{
private CronManagerInterface $cronManager;
public function __construct(
CronManagerInterface $cronManager
private CronManagerInterface $cronManager
) {
parent::__construct('chill:cron-job:execute');
$this->cronManager = $cronManager;
}
protected function configure()

View File

@@ -20,17 +20,11 @@ use Symfony\Component\Console\Output\OutputInterface;
class LoadAddressesBEFromBestAddressCommand extends Command
{
private AddressReferenceBEFromBestAddress $addressImporter;
private PostalCodeBEFromBestAddress $postalCodeBEFromBestAddressImporter;
public function __construct(
AddressReferenceBEFromBestAddress $addressImporter,
PostalCodeBEFromBestAddress $postalCodeBEFromBestAddressImporter
private AddressReferenceBEFromBestAddress $addressImporter,
private PostalCodeBEFromBestAddress $postalCodeBEFromBestAddressImporter
) {
parent::__construct();
$this->addressImporter = $addressImporter;
$this->postalCodeBEFromBestAddressImporter = $postalCodeBEFromBestAddressImporter;
}
protected function configure()

View File

@@ -19,12 +19,9 @@ use Symfony\Component\Console\Output\OutputInterface;
class LoadAddressesFRFromBANOCommand extends Command
{
private AddressReferenceFromBano $addressReferenceFromBano;
public function __construct(AddressReferenceFromBano $addressReferenceFromBano)
public function __construct(private AddressReferenceFromBano $addressReferenceFromBano)
{
parent::__construct();
$this->addressReferenceFromBano = $addressReferenceFromBano;
}
protected function configure()

View File

@@ -34,13 +34,6 @@ class LoadAndUpdateLanguagesCommand extends Command
private $ancientToExclude = ['ang', 'egy', 'fro', 'goh', 'grc', 'la', 'non', 'peo', 'pro', 'sga',
'dum', 'enm', 'frm', 'gmh', 'mga', 'akk', 'phn', 'zxx', 'got', 'und', ];
private $availableLanguages;
/**
* @var EntityManager
*/
private $entityManager;
// The regional version of language are language with _ in the code
// This array contains regional code to not exclude
private $regionalVersionToInclude = ['ro_MD'];
@@ -50,10 +43,8 @@ class LoadAndUpdateLanguagesCommand extends Command
*
* @param $availableLanguages
*/
public function __construct(EntityManager $entityManager, $availableLanguages)
public function __construct(private EntityManager $entityManager, private $availableLanguages)
{
$this->entityManager = $entityManager;
$this->availableLanguages = $availableLanguages;
parent::__construct();
}

View File

@@ -20,22 +20,13 @@ use Symfony\Component\Intl\Intl;
class LoadCountriesCommand extends Command
{
private $availableLanguages;
/**
* @var EntityManager
*/
private $entityManager;
/**
* LoadCountriesCommand constructor.
*
* @param $availableLanguages
*/
public function __construct(EntityManager $entityManager, $availableLanguages)
public function __construct(private EntityManager $entityManager, private $availableLanguages)
{
$this->entityManager = $entityManager;
$this->availableLanguages = $availableLanguages;
parent::__construct();
}

View File

@@ -18,12 +18,8 @@ use Symfony\Component\Console\Output\OutputInterface;
class LoadPostalCodeFR extends Command
{
private PostalCodeFRFromOpenData $loader;
public function __construct(PostalCodeFRFromOpenData $loader)
public function __construct(private PostalCodeFRFromOpenData $loader)
{
$this->loader = $loader;
parent::__construct();
}

View File

@@ -30,14 +30,8 @@ use function strlen;
class LoadPostalCodesCommand extends Command
{
private EntityManagerInterface $entityManager;
private ValidatorInterface $validator;
public function __construct(EntityManagerInterface $entityManager, ValidatorInterface $validator)
public function __construct(private EntityManagerInterface $entityManager, private ValidatorInterface $validator)
{
$this->entityManager = $entityManager;
$this->validator = $validator;
parent::__construct();
}

View File

@@ -26,17 +26,11 @@ use Symfony\Component\Security\Core\Encoder\MessageDigestPasswordEncoder;
*/
class SetPasswordCommand extends Command
{
/**
* @var EntityManager
*/
private $entityManager;
/**
* SetPasswordCommand constructor.
*/
public function __construct(EntityManager $entityManager)
public function __construct(private EntityManager $entityManager)
{
$this->entityManager = $entityManager;
parent::__construct();
}