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

@@ -21,7 +21,7 @@ use Symfony\Component\HttpFoundation\Request;
final class AsideActivityController extends CRUDController
{
public function __construct(private AsideActivityCategoryRepository $categoryRepository)
public function __construct(private readonly AsideActivityCategoryRepository $categoryRepository)
{
}

View File

@@ -24,7 +24,7 @@ use function random_int;
class LoadAsideActivity extends Fixture implements DependentFixtureInterface
{
public function __construct(private UserRepository $userRepository)
public function __construct(private readonly UserRepository $userRepository)
{
}

View File

@@ -20,7 +20,7 @@ use Symfony\Component\Form\FormBuilderInterface;
class ByActivityTypeAggregator implements AggregatorInterface
{
public function __construct(private AsideActivityCategoryRepository $asideActivityCategoryRepository, private TranslatableStringHelper $translatableStringHelper)
public function __construct(private readonly AsideActivityCategoryRepository $asideActivityCategoryRepository, private readonly TranslatableStringHelper $translatableStringHelper)
{
}

View File

@@ -22,7 +22,7 @@ use function in_array;
class ByUserJobAggregator implements AggregatorInterface
{
public function __construct(private UserJobRepositoryInterface $userJobRepository, private TranslatableStringHelperInterface $translatableStringHelper)
public function __construct(private readonly UserJobRepositoryInterface $userJobRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper)
{
}

View File

@@ -22,7 +22,7 @@ use function in_array;
class ByUserScopeAggregator implements AggregatorInterface
{
public function __construct(private ScopeRepositoryInterface $scopeRepository, private TranslatableStringHelperInterface $translatableStringHelper)
public function __construct(private readonly ScopeRepositoryInterface $scopeRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper)
{
}

View File

@@ -16,5 +16,5 @@ namespace Chill\AsideActivityBundle\Export;
*/
abstract class Declarations
{
public const ASIDE_ACTIVITY_TYPE = 'aside_activity';
final public const ASIDE_ACTIVITY_TYPE = 'aside_activity';
}

View File

@@ -23,7 +23,7 @@ use Symfony\Component\Form\FormBuilderInterface;
class AvgAsideActivityDuration implements ExportInterface, GroupedExportInterface
{
public function __construct(private AsideActivityRepository $repository)
public function __construct(private readonly AsideActivityRepository $repository)
{
}

View File

@@ -23,7 +23,7 @@ use Symfony\Component\Form\FormBuilderInterface;
class CountAsideActivity implements ExportInterface, GroupedExportInterface
{
public function __construct(private AsideActivityRepository $repository)
public function __construct(private readonly AsideActivityRepository $repository)
{
}

View File

@@ -32,7 +32,7 @@ use Doctrine\ORM\QueryBuilder;
use LogicException;
use Symfony\Component\Form\FormBuilderInterface;
final class ListAsideActivity implements ListInterface, GroupedExportInterface
final readonly class ListAsideActivity implements ListInterface, GroupedExportInterface
{
public function __construct(private EntityManagerInterface $em, private DateTimeHelper $dateTimeHelper, private UserHelper $userHelper, private ScopeRepositoryInterface $scopeRepository, private CenterRepositoryInterface $centerRepository, private AsideActivityCategoryRepository $asideActivityCategoryRepository, private CategoryRender $categoryRender, private TranslatableStringHelperInterface $translatableStringHelper)
{

View File

@@ -23,7 +23,7 @@ use Symfony\Component\Form\FormBuilderInterface;
class SumAsideActivityDuration implements ExportInterface, GroupedExportInterface
{
public function __construct(private AsideActivityRepository $repository)
public function __construct(private readonly AsideActivityRepository $repository)
{
}

View File

@@ -23,7 +23,7 @@ use Symfony\Component\Form\FormBuilderInterface;
class ByActivityTypeFilter implements FilterInterface
{
public function __construct(private CategoryRender $categoryRender, private TranslatableStringHelperInterface $translatableStringHelper, private AsideActivityCategoryRepository $asideActivityTypeRepository)
public function __construct(private readonly CategoryRender $categoryRender, private readonly TranslatableStringHelperInterface $translatableStringHelper, private readonly AsideActivityCategoryRepository $asideActivityTypeRepository)
{
}

View File

@@ -26,7 +26,7 @@ use Symfony\Contracts\Translation\TranslatorInterface;
class ByDateFilter implements FilterInterface
{
public function __construct(private RollingDateConverterInterface $rollingDateConverter, protected TranslatorInterface $translator)
public function __construct(private readonly RollingDateConverterInterface $rollingDateConverter, protected TranslatorInterface $translator)
{
}

View File

@@ -20,7 +20,7 @@ use Symfony\Component\Form\FormBuilderInterface;
class ByUserFilter implements FilterInterface
{
public function __construct(private UserRender $userRender)
public function __construct(private readonly UserRender $userRender)
{
}

View File

@@ -22,7 +22,7 @@ use Symfony\Component\Form\FormBuilderInterface;
class ByUserJobFilter implements FilterInterface
{
public function __construct(private TranslatableStringHelperInterface $translatableStringHelper)
public function __construct(private readonly TranslatableStringHelperInterface $translatableStringHelper)
{
}

View File

@@ -23,7 +23,7 @@ use Symfony\Component\Form\FormBuilderInterface;
class ByUserScopeFilter implements FilterInterface
{
public function __construct(private ScopeRepositoryInterface $scopeRepository, private TranslatableStringHelperInterface $translatableStringHelper)
public function __construct(private readonly ScopeRepositoryInterface $scopeRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper)
{
}

View File

@@ -22,7 +22,7 @@ use Symfony\Component\Form\FormBuilderInterface;
final class AsideActivityCategoryType extends AbstractType
{
public function __construct(private CategoryRender $categoryRender)
public function __construct(private readonly CategoryRender $categoryRender)
{
}

View File

@@ -33,7 +33,7 @@ use function in_array;
final class AsideActivityFormType extends AbstractType
{
private array $timeChoices;
private readonly array $timeChoices;
public function __construct(
ParameterBagInterface $parameterBag,
@@ -105,13 +105,7 @@ final class AsideActivityFormType extends AbstractType
if (!in_array($data->getTimestamp(), $timeChoices, true)) {
// the data are not in the possible values. add them
$timeChoices[$data->format('H:i')] = $data->getTimestamp();
$form = $builder->create($fieldName, ChoiceType::class, array_merge(
$durationTimeOptions,
[
'choices' => $timeChoices,
'auto_initialize' => false,
]
));
$form = $builder->create($fieldName, ChoiceType::class, [...$durationTimeOptions, 'choices' => $timeChoices, 'auto_initialize' => false]);
$form->addModelTransformer($durationTimeTransformer);
$formEvent->getForm()->getParent()->add($form->getForm());
}

View File

@@ -20,7 +20,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
final class PickAsideActivityCategoryType extends AbstractType
{
public function __construct(private CategoryRender $categoryRender)
public function __construct(private readonly CategoryRender $categoryRender)
{
}

View File

@@ -14,7 +14,7 @@ namespace Chill\AsideActivityBundle\Menu;
use Knp\Menu\MenuItem;
use Symfony\Component\Security\Core\Security;
final class AdminMenuBuilder implements \Chill\MainBundle\Routing\LocalMenuBuilderInterface
final readonly class AdminMenuBuilder implements \Chill\MainBundle\Routing\LocalMenuBuilderInterface
{
public function __construct(private Security $security)
{

View File

@@ -18,7 +18,7 @@ use Doctrine\Persistence\ObjectRepository;
class AsideActivityCategoryRepository implements ObjectRepository
{
private EntityRepository $repository;
private readonly EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{

View File

@@ -21,9 +21,9 @@ use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
class AsideActivityVoter extends AbstractChillVoter implements ProvideRoleHierarchyInterface
{
public const STATS = 'CHILL_ASIDE_ACTIVITY_STATS';
final public const STATS = 'CHILL_ASIDE_ACTIVITY_STATS';
private VoterHelperInterface $voterHelper;
private readonly VoterHelperInterface $voterHelper;
public function __construct(
VoterHelperFactoryInterface $voterHelperFactory

View File

@@ -19,7 +19,7 @@ use Symfony\Component\Templating\EngineInterface;
/**
* @implements ChillEntityRenderInterface<AsideActivityCategory>
*/
final class CategoryRender implements ChillEntityRenderInterface
final readonly class CategoryRender implements ChillEntityRenderInterface
{
public const DEFAULT_ARGS = [
self::SEPERATOR_KEY => ' > ',