DX: apply rector rules up to php8.0

This commit is contained in:
2023-04-15 01:05:37 +02:00
parent d8870e906f
commit dde3002100
714 changed files with 2348 additions and 9263 deletions

View File

@@ -38,25 +38,12 @@ class ByEndDateAggregator implements AggregatorInterface
public function alterQuery(QueryBuilder $qb, $data)
{
switch ($data['frequency']) {
case 'week':
$fmt = 'YYYY-IW';
break;
case 'month':
$fmt = 'YYYY-MM';
break;
case 'year':
$fmt = 'YYYY';
break;
default:
throw new LogicException(sprintf("The frequency data '%s' is invalid.", $data['frequency']));
}
$fmt = match ($data['frequency']) {
'week' => 'YYYY-IW',
'month' => 'YYYY-MM',
'year' => 'YYYY',
default => throw new LogicException(sprintf("The frequency data '%s' is invalid.", $data['frequency'])),
};
$qb->addSelect(sprintf("TO_CHAR(workeval.endDate, '%s') AS eval_by_end_date_aggregator", $fmt));
$qb->addGroupBy(' eval_by_end_date_aggregator');

View File

@@ -38,25 +38,12 @@ class ByMaxDateAggregator implements AggregatorInterface
public function alterQuery(QueryBuilder $qb, $data)
{
switch ($data['frequency']) {
case 'week':
$fmt = 'YYYY-IW';
break;
case 'month':
$fmt = 'YYYY-MM';
break;
case 'year':
$fmt = 'YYYY';
break;
default:
throw new LogicException(sprintf("The frequency data '%s' is invalid.", $data['frequency']));
}
$fmt = match ($data['frequency']) {
'week' => 'YYYY-IW',
'month' => 'YYYY-MM',
'year' => 'YYYY',
default => throw new LogicException(sprintf("The frequency data '%s' is invalid.", $data['frequency'])),
};
$qb->addSelect(sprintf("TO_CHAR(workeval.maxDate, '%s') AS eval_by_max_date_aggregator", $fmt));
$qb->addGroupBy(' eval_by_max_date_aggregator');

View File

@@ -38,25 +38,12 @@ class ByStartDateAggregator implements AggregatorInterface
public function alterQuery(QueryBuilder $qb, $data)
{
switch ($data['frequency']) {
case 'week':
$fmt = 'YYYY-IW';
break;
case 'month':
$fmt = 'YYYY-MM';
break;
case 'year':
$fmt = 'YYYY';
break;
default:
throw new LogicException(sprintf("The frequency data '%s' is invalid.", $data['frequency']));
}
$fmt = match ($data['frequency']) {
'week' => 'YYYY-IW',
'month' => 'YYYY-MM',
'year' => 'YYYY',
default => throw new LogicException(sprintf("The frequency data '%s' is invalid.", $data['frequency'])),
};
$qb->addSelect(sprintf("TO_CHAR(workeval.startDate, '%s') AS eval_by_start_date_aggregator", $fmt));
$qb->addGroupBy(' eval_by_start_date_aggregator');

View File

@@ -20,16 +20,8 @@ use Symfony\Component\Form\FormBuilderInterface;
class EvaluationTypeAggregator implements AggregatorInterface
{
private EvaluationRepository $evaluationRepository;
private TranslatableStringHelper $translatableStringHelper;
public function __construct(
EvaluationRepository $evaluationRepository,
TranslatableStringHelper $translatableStringHelper
) {
$this->evaluationRepository = $evaluationRepository;
$this->translatableStringHelper = $translatableStringHelper;
public function __construct(private EvaluationRepository $evaluationRepository, private TranslatableStringHelper $translatableStringHelper)
{
}
public function addRole(): ?string

View File

@@ -20,11 +20,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
class HavingEndDateAggregator implements AggregatorInterface
{
private TranslatorInterface $translator;
public function __construct(TranslatorInterface $translator)
public function __construct(private TranslatorInterface $translator)
{
$this->translator = $translator;
}
public function addRole(): ?string
@@ -56,16 +53,11 @@ class HavingEndDateAggregator implements AggregatorInterface
return 'export.aggregator.eval.by_end_date.Has end date ?';
}
switch ($value) {
case true:
return $this->translator->trans('export.aggregator.eval.by_end_date.enddate is specified');
case false:
return $this->translator->trans('export.aggregator.eval.by_end_date.enddate is not specified');
default:
throw new LogicException(sprintf('The value %s is not valid', $value));
}
return match ($value) {
true => $this->translator->trans('export.aggregator.eval.by_end_date.enddate is specified'),
false => $this->translator->trans('export.aggregator.eval.by_end_date.enddate is not specified'),
default => throw new LogicException(sprintf('The value %s is not valid', $value)),
};
};
}