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

@@ -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)
{
}

View File

@@ -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)
{
}

View File

@@ -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)
{
}

View File

@@ -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] ';

View File

@@ -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)
{
}

View File

@@ -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'],

View File

@@ -57,7 +57,7 @@ class PostalCodeBaseImporter
private array $waitingForInsert = [];
public function __construct(private Connection $defaultConnection)
public function __construct(private readonly Connection $defaultConnection)
{
}

View File

@@ -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,