mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-29 19:13:49 +00:00
apply rector rules: php up to php82
This commit is contained in:
@@ -20,7 +20,7 @@ use UnexpectedValueException;
|
||||
|
||||
class RefreshAddressToGeographicalUnitMaterializedViewCronJob implements CronJobInterface
|
||||
{
|
||||
public function __construct(private Connection $connection)
|
||||
public function __construct(private readonly Connection $connection)
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -19,8 +19,8 @@ class ViewEntityInfoManager
|
||||
/**
|
||||
* @var ViewEntityInfoProviderInterface[]
|
||||
*/
|
||||
private iterable $vienEntityInfoProviders,
|
||||
private Connection $connection,
|
||||
private readonly iterable $vienEntityInfoProviders,
|
||||
private readonly Connection $connection,
|
||||
) {
|
||||
}
|
||||
|
||||
|
@@ -22,7 +22,7 @@ class AddressReferenceBEFromBestAddress
|
||||
{
|
||||
private const RELEASE = 'https://gitea.champs-libres.be/api/v1/repos/Chill-project/belgian-bestaddresses-transform/releases/tags/v1.0.0';
|
||||
|
||||
public function __construct(private HttpClientInterface $client, private AddressReferenceBaseImporter $baseImporter, private AddressToReferenceMatcher $addressToReferenceMatcher)
|
||||
public function __construct(private readonly HttpClientInterface $client, private readonly AddressReferenceBaseImporter $baseImporter, private readonly AddressToReferenceMatcher $addressToReferenceMatcher)
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -50,7 +50,7 @@ final class AddressReferenceBaseImporter
|
||||
|
||||
private array $waitingForInsert = [];
|
||||
|
||||
public function __construct(private Connection $defaultConnection, private LoggerInterface $logger)
|
||||
public function __construct(private readonly Connection $defaultConnection, private readonly LoggerInterface $logger)
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -20,7 +20,7 @@ use function is_int;
|
||||
|
||||
class AddressReferenceFromBano
|
||||
{
|
||||
public function __construct(private HttpClientInterface $client, private AddressReferenceBaseImporter $baseImporter, private AddressToReferenceMatcher $addressToReferenceMatcher)
|
||||
public function __construct(private readonly HttpClientInterface $client, private readonly AddressReferenceBaseImporter $baseImporter, private readonly AddressToReferenceMatcher $addressToReferenceMatcher)
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -19,7 +19,7 @@ use Psr\Log\LoggerInterface;
|
||||
* Mark existing addresses as to be reviewed regarding the
|
||||
* address reference
|
||||
*/
|
||||
final class AddressToReferenceMatcher
|
||||
final readonly class AddressToReferenceMatcher
|
||||
{
|
||||
private const LOG_PREFIX = '[address_to_reference_matcher] ';
|
||||
|
||||
|
@@ -47,7 +47,7 @@ final class GeographicalUnitBaseImporter
|
||||
|
||||
private array $waitingForInsert = [];
|
||||
|
||||
public function __construct(private Connection $defaultConnection, private LoggerInterface $logger)
|
||||
public function __construct(private readonly Connection $defaultConnection, private readonly LoggerInterface $logger)
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -21,7 +21,7 @@ class PostalCodeBEFromBestAddress
|
||||
{
|
||||
private const RELEASE = 'https://gitea.champs-libres.be/api/v1/repos/Chill-project/belgian-bestaddresses-transform/releases/tags/v1.0.0';
|
||||
|
||||
public function __construct(private PostalCodeBaseImporter $baseImporter, private HttpClientInterface $client, private LoggerInterface $logger)
|
||||
public function __construct(private readonly PostalCodeBaseImporter $baseImporter, private readonly HttpClientInterface $client, private readonly LoggerInterface $logger)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -82,8 +82,8 @@ class PostalCodeBEFromBestAddress
|
||||
{
|
||||
$this->baseImporter->importCode(
|
||||
'BE',
|
||||
trim($record['municipality_name']),
|
||||
trim($record['postal_info_objectid']),
|
||||
trim((string) $record['municipality_name']),
|
||||
trim((string) $record['postal_info_objectid']),
|
||||
$record['municipality_objectid'],
|
||||
'bestaddress',
|
||||
(float) $record['Y'],
|
||||
|
@@ -57,7 +57,7 @@ class PostalCodeBaseImporter
|
||||
|
||||
private array $waitingForInsert = [];
|
||||
|
||||
public function __construct(private Connection $defaultConnection)
|
||||
public function __construct(private readonly Connection $defaultConnection)
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -26,7 +26,7 @@ class PostalCodeFRFromOpenData
|
||||
{
|
||||
private const CSV = 'https://datanova.legroupe.laposte.fr/explore/dataset/laposte_hexasmal/download/?format=csv&timezone=Europe/Berlin&lang=fr&use_labels_for_header=true&csv_separator=%3B';
|
||||
|
||||
public function __construct(private PostalCodeBaseImporter $baseImporter, private HttpClientInterface $client, private LoggerInterface $logger)
|
||||
public function __construct(private readonly PostalCodeBaseImporter $baseImporter, private readonly HttpClientInterface $client, private readonly LoggerInterface $logger)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -72,17 +72,17 @@ class PostalCodeFRFromOpenData
|
||||
$lat = $lon = 0.0;
|
||||
}
|
||||
|
||||
$ref = trim($record['Code_commune_INSEE']);
|
||||
$ref = trim((string) $record['Code_commune_INSEE']);
|
||||
|
||||
if (str_starts_with($ref, '987')) {
|
||||
// some differences in French Polynesia
|
||||
$ref .= '.' . trim($record['Libellé_d_acheminement']);
|
||||
$ref .= '.' . trim((string) $record['Libellé_d_acheminement']);
|
||||
}
|
||||
|
||||
$this->baseImporter->importCode(
|
||||
'FR',
|
||||
trim($record['Libellé_d_acheminement']),
|
||||
trim($record['Code_postal']),
|
||||
trim((string) $record['Libellé_d_acheminement']),
|
||||
trim((string) $record['Code_postal']),
|
||||
$ref,
|
||||
'INSEE',
|
||||
$lat,
|
||||
|
@@ -22,7 +22,7 @@ class ChillMailer implements MailerInterface
|
||||
{
|
||||
private string $prefix = '[Chill] ';
|
||||
|
||||
public function __construct(private MailerInterface $initial, private LoggerInterface $chillLogger)
|
||||
public function __construct(private readonly MailerInterface $initial, private readonly LoggerInterface $chillLogger)
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -15,7 +15,7 @@ use DateTimeImmutable;
|
||||
|
||||
class RollingDate
|
||||
{
|
||||
public const ALL_T = [
|
||||
final public const ALL_T = [
|
||||
self::T_YEAR_PREVIOUS_START,
|
||||
self::T_QUARTER_PREVIOUS_START,
|
||||
self::T_MONTH_PREVIOUS_START,
|
||||
@@ -35,47 +35,43 @@ class RollingDate
|
||||
/**
|
||||
* A given fixed date.
|
||||
*/
|
||||
public const T_FIXED_DATE = 'fixed_date';
|
||||
final public const T_FIXED_DATE = 'fixed_date';
|
||||
|
||||
public const T_MONTH_CURRENT_START = 'month_current_start';
|
||||
final public const T_MONTH_CURRENT_START = 'month_current_start';
|
||||
|
||||
public const T_MONTH_NEXT_START = 'month_next_start';
|
||||
final public const T_MONTH_NEXT_START = 'month_next_start';
|
||||
|
||||
public const T_MONTH_PREVIOUS_START = 'month_previous_start';
|
||||
final public const T_MONTH_PREVIOUS_START = 'month_previous_start';
|
||||
|
||||
public const T_QUARTER_CURRENT_START = 'quarter_current_start';
|
||||
final public const T_QUARTER_CURRENT_START = 'quarter_current_start';
|
||||
|
||||
public const T_QUARTER_NEXT_START = 'quarter_next_start';
|
||||
final public const T_QUARTER_NEXT_START = 'quarter_next_start';
|
||||
|
||||
public const T_QUARTER_PREVIOUS_START = 'quarter_previous_start';
|
||||
final public const T_QUARTER_PREVIOUS_START = 'quarter_previous_start';
|
||||
|
||||
public const T_TODAY = 'today';
|
||||
final public const T_TODAY = 'today';
|
||||
|
||||
public const T_WEEK_CURRENT_START = 'week_current_start';
|
||||
final public const T_WEEK_CURRENT_START = 'week_current_start';
|
||||
|
||||
public const T_WEEK_NEXT_START = 'week_next_start';
|
||||
final public const T_WEEK_NEXT_START = 'week_next_start';
|
||||
|
||||
public const T_WEEK_PREVIOUS_START = 'week_previous_start';
|
||||
final public const T_WEEK_PREVIOUS_START = 'week_previous_start';
|
||||
|
||||
public const T_YEAR_CURRENT_START = 'year_current_start';
|
||||
final public const T_YEAR_CURRENT_START = 'year_current_start';
|
||||
|
||||
public const T_YEAR_NEXT_START = 'year_next_start';
|
||||
final public const T_YEAR_NEXT_START = 'year_next_start';
|
||||
|
||||
public const T_YEAR_PREVIOUS_START = 'year_previous_start';
|
||||
|
||||
/**
|
||||
* The pivot date is the date from the rolling is computed. By default, it is "now".
|
||||
*/
|
||||
private DateTimeImmutable $pivotDate;
|
||||
final public const T_YEAR_PREVIOUS_START = 'year_previous_start';
|
||||
|
||||
/**
|
||||
* @param string|self::T_* $roll
|
||||
* @param DateTimeImmutable|null $pivotDate Will be "now" if null is given
|
||||
* @param DateTimeImmutable|null $fixedDate Only to insert if $roll equals @see{self::T_FIXED_DATE}
|
||||
*/
|
||||
public function __construct(private string $roll, private ?\DateTimeImmutable $fixedDate = null, ?DateTimeImmutable $pivotDate = null)
|
||||
{
|
||||
$this->pivotDate = $pivotDate ?? new DateTimeImmutable('now');
|
||||
public function __construct(
|
||||
private readonly string $roll,
|
||||
private readonly ?\DateTimeImmutable $fixedDate = null,
|
||||
private readonly DateTimeImmutable $pivotDate = new DateTimeImmutable('now')
|
||||
) {
|
||||
}
|
||||
|
||||
public function getFixedDate(): ?DateTimeImmutable
|
||||
|
@@ -22,9 +22,9 @@ use libphonenumber\PhoneNumber;
|
||||
|
||||
class ShortMessage
|
||||
{
|
||||
public const PRIORITY_LOW = 'low';
|
||||
final public const PRIORITY_LOW = 'low';
|
||||
|
||||
public const PRIORITY_MEDIUM = 'medium';
|
||||
final public const PRIORITY_MEDIUM = 'medium';
|
||||
|
||||
public function __construct(private string $content, private PhoneNumber $phoneNumber, private string $priority = 'low')
|
||||
{
|
||||
|
@@ -25,7 +25,7 @@ use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
|
||||
*/
|
||||
class ShortMessageHandler implements MessageHandlerInterface
|
||||
{
|
||||
public function __construct(private ShortMessageTransporterInterface $messageTransporter)
|
||||
public function __construct(private readonly ShortMessageTransporterInterface $messageTransporter)
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -20,7 +20,7 @@ namespace Chill\MainBundle\Service\ShortMessage;
|
||||
|
||||
class ShortMessageTransporter implements ShortMessageTransporterInterface
|
||||
{
|
||||
public function __construct(private ShortMessageSenderInterface $sender)
|
||||
public function __construct(private readonly ShortMessageSenderInterface $sender)
|
||||
{
|
||||
}
|
||||
|
||||
|
@@ -28,14 +28,14 @@ use Psr\Log\LoggerInterface;
|
||||
class OvhShortMessageSender implements ShortMessageSenderInterface
|
||||
{
|
||||
public function __construct(
|
||||
private Api $api,
|
||||
private readonly Api $api,
|
||||
// for DI, must remains as first argument
|
||||
private string $serviceName,
|
||||
private readonly string $serviceName,
|
||||
// for di, must remains as second argument
|
||||
private string $sender,
|
||||
private readonly string $sender,
|
||||
// for DI, must remains as third argument
|
||||
private LoggerInterface $logger,
|
||||
private PhoneNumberUtil $phoneNumberUtil
|
||||
private readonly LoggerInterface $logger,
|
||||
private readonly PhoneNumberUtil $phoneNumberUtil
|
||||
) {
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user