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

@@ -18,7 +18,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
class DateTimeHelper
{
public function __construct(private TranslatorInterface $translator)
public function __construct(private readonly TranslatorInterface $translator)
{
}

View File

@@ -32,25 +32,25 @@ class ExportAddressHelper
/**
* Compute all the F_* constants.
*/
public const F_ALL =
final public const F_ALL =
self::F_ATTRIBUTES | self::F_BUILDING | self::F_COUNTRY |
self::F_GEOM | self::F_POSTAL_CODE | self::F_STREET | self::F_GEOGRAPHICAL_UNITS;
public const F_AS_STRING = 0b00010000;
final public const F_AS_STRING = 0b00010000;
public const F_ATTRIBUTES = 0b01000000;
final public const F_ATTRIBUTES = 0b01000000;
public const F_BUILDING = 0b00001000;
final public const F_BUILDING = 0b00001000;
public const F_COUNTRY = 0b00000001;
final public const F_COUNTRY = 0b00000001;
public const F_GEOGRAPHICAL_UNITS = 0b1000000000;
final public const F_GEOGRAPHICAL_UNITS = 0b1000000000;
public const F_GEOM = 0b00100000;
final public const F_GEOM = 0b00100000;
public const F_POSTAL_CODE = 0b00000010;
final public const F_POSTAL_CODE = 0b00000010;
public const F_STREET = 0b00000100;
final public const F_STREET = 0b00000100;
private const ALL = [
'country' => self::F_COUNTRY,
@@ -84,7 +84,7 @@ class ExportAddressHelper
*/
private ?array $unitRefsKeysCache = [];
public function __construct(private AddressRender $addressRender, private AddressRepository $addressRepository, private GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository, private TranslatableStringHelperInterface $translatableStringHelper)
public function __construct(private readonly AddressRender $addressRender, private readonly AddressRepository $addressRepository, private readonly GeographicalUnitLayerRepositoryInterface $geographicalUnitLayerRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper)
{
}
@@ -253,7 +253,7 @@ class ExportAddressHelper
public function getLabel($key, array $values, $data, string $prefix = '', string $translationPrefix = 'export.address_helper.'): callable
{
$sanitizedKey = substr($key, strlen($prefix));
$sanitizedKey = substr((string) $key, strlen($prefix));
switch ($sanitizedKey) {
case 'id':
@@ -333,7 +333,7 @@ class ExportAddressHelper
};
default:
$layerNamesKeys = array_merge($this->generateKeysForUnitsNames($prefix), $this->generateKeysForUnitsRefs($prefix));
$layerNamesKeys = [...$this->generateKeysForUnitsNames($prefix), ...$this->generateKeysForUnitsRefs($prefix)];
if (array_key_exists($key, $layerNamesKeys)) {
return function ($value) use ($key, $layerNamesKeys) {

View File

@@ -21,7 +21,7 @@ use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
*/
class TranslatableStringExportLabelHelper
{
public function __construct(private TranslatableStringHelperInterface $translatableStringHelper)
public function __construct(private readonly TranslatableStringHelperInterface $translatableStringHelper)
{
}

View File

@@ -18,7 +18,7 @@ use const SORT_NUMERIC;
class UserHelper
{
public function __construct(private UserRender $userRender, private UserRepositoryInterface $userRepository)
public function __construct(private readonly UserRender $userRender, private readonly UserRepositoryInterface $userRepository)
{
}