apply rector rules: php up to php82

This commit is contained in:
2023-07-19 23:16:01 +02:00
parent 7b637d1287
commit 023a29cb78
744 changed files with 1369 additions and 1381 deletions

View File

@@ -78,7 +78,7 @@ interface AggregatorInterface extends ModifierInterface
*
* @return Closure where the first argument is the value, and the function should return the label to show in the formatted file. Example : `function($countryCode) use ($countries) { return $countries[$countryCode]->getName(); }`
*/
public function getLabels($key, array $values, $data);
public function getLabels($key, array $values, mixed $data);
/**
* give the list of keys the current export added to the queryBuilder in

View File

@@ -33,5 +33,5 @@ interface ExportElementValidatedInterface
*
* @param mixed $data the data, as returned by the user
*/
public function validateForm($data, ExecutionContextInterface $context);
public function validateForm(mixed $data, ExecutionContextInterface $context);
}

View File

@@ -99,7 +99,7 @@ interface ExportInterface extends ExportElementInterface
*
* @return (callable(null|string|int|float|'_header' $value): string|int|\DateTimeInterface) where the first argument is the value, and the function should return the label to show in the formatted file. Example : `function($countryCode) use ($countries) { return $countries[$countryCode]->getName(); }`
*/
public function getLabels($key, array $values, $data);
public function getLabels($key, array $values, mixed $data);
/**
* give the list of keys the current export added to the queryBuilder in

View File

@@ -70,9 +70,9 @@ class ExportManager
private $user;
public function __construct(
private LoggerInterface $logger,
private AuthorizationCheckerInterface $authorizationChecker,
private AuthorizationHelperInterface $authorizationHelper,
private readonly LoggerInterface $logger,
private readonly AuthorizationCheckerInterface $authorizationChecker,
private readonly AuthorizationHelperInterface $authorizationHelper,
TokenStorageInterface $tokenStorage,
iterable $exports,
iterable $aggregators,

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