apply rules rector up to php82

This commit is contained in:
2023-05-01 21:39:45 +02:00
parent 81e8928344
commit 6d63177ff4
733 changed files with 1257 additions and 1322 deletions

View File

@@ -138,8 +138,8 @@ class ChillImportUsersCommand extends Command
{
$user = new User();
$user
->setEmail(trim($data['email']))
->setUsername(trim($data['username']))
->setEmail(trim((string) $data['email']))
->setUsername(trim((string) $data['username']))
->setEnabled(true)
->setPassword($this->passwordEncoder->encodePassword(
$user,

View File

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

View File

@@ -20,7 +20,7 @@ use Symfony\Component\Console\Output\OutputInterface;
class ExecuteCronJobCommand extends Command
{
public function __construct(
private CronManagerInterface $cronManager
private readonly CronManagerInterface $cronManager
) {
parent::__construct('chill:cron-job:execute');
}

View File

@@ -21,8 +21,8 @@ use Symfony\Component\Console\Output\OutputInterface;
class LoadAddressesBEFromBestAddressCommand extends Command
{
public function __construct(
private AddressReferenceBEFromBestAddress $addressImporter,
private PostalCodeBEFromBestAddress $postalCodeBEFromBestAddressImporter
private readonly AddressReferenceBEFromBestAddress $addressImporter,
private readonly PostalCodeBEFromBestAddress $postalCodeBEFromBestAddressImporter
) {
parent::__construct();
}

View File

@@ -19,7 +19,7 @@ use Symfony\Component\Console\Output\OutputInterface;
class LoadAddressesFRFromBANOCommand extends Command
{
public function __construct(private AddressReferenceFromBano $addressReferenceFromBano)
public function __construct(private readonly AddressReferenceFromBano $addressReferenceFromBano)
{
parent::__construct();
}

View File

@@ -26,9 +26,9 @@ use function in_array;
*/
class LoadAndUpdateLanguagesCommand extends Command
{
public const INCLUDE_ANCIENT = 'include_ancient';
final public const INCLUDE_ANCIENT = 'include_ancient';
public const INCLUDE_REGIONAL_VERSION = 'include_regional';
final public const INCLUDE_REGIONAL_VERSION = 'include_regional';
// Array of ancien languages (to exclude)
private $ancientToExclude = ['ang', 'egy', 'fro', 'goh', 'grc', 'la', 'non', 'peo', 'pro', 'sga',
@@ -43,7 +43,7 @@ class LoadAndUpdateLanguagesCommand extends Command
*
* @param $availableLanguages
*/
public function __construct(private EntityManager $entityManager, private $availableLanguages)
public function __construct(private readonly EntityManager $entityManager, private $availableLanguages)
{
parent::__construct();
}

View File

@@ -25,7 +25,7 @@ class LoadCountriesCommand extends Command
*
* @param $availableLanguages
*/
public function __construct(private EntityManager $entityManager, private $availableLanguages)
public function __construct(private readonly EntityManager $entityManager, private $availableLanguages)
{
parent::__construct();
}

View File

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

View File

@@ -30,7 +30,7 @@ use function strlen;
class LoadPostalCodesCommand extends Command
{
public function __construct(private EntityManagerInterface $entityManager, private ValidatorInterface $validator)
public function __construct(private readonly EntityManagerInterface $entityManager, private readonly ValidatorInterface $validator)
{
parent::__construct();
}
@@ -90,7 +90,7 @@ class LoadPostalCodesCommand extends Command
0,
$input->getOption('delimiter'),
$input->getOption('enclosure'),
$input->getOption('escape')
(string) $input->getOption('escape')
))
) {
try {
@@ -109,7 +109,7 @@ class LoadPostalCodesCommand extends Command
private function addPostalCode($row, OutputInterface $output)
{
if ('FR' === $row[2] && strlen($row[0]) === 4) {
if ('FR' === $row[2] && strlen((string) $row[0]) === 4) {
// CP in FRANCE are on 5 digit
// For CP starting with a zero, the starting zero can be remove if stored as number in a csv
// add a zero if CP from FR and on 4 digit

View File

@@ -29,7 +29,7 @@ class SetPasswordCommand extends Command
/**
* SetPasswordCommand constructor.
*/
public function __construct(private EntityManager $entityManager)
public function __construct(private readonly EntityManager $entityManager)
{
parent::__construct();
}