Skip to content

Commit

Permalink
Run rector
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentLanglet committed Dec 7, 2024
1 parent c5cf49f commit 257c183
Show file tree
Hide file tree
Showing 96 changed files with 198 additions and 204 deletions.
6 changes: 3 additions & 3 deletions src/Action/AppendFormFieldElementAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
final class AppendFormFieldElementAction
{
public function __construct(
private Environment $twig,
private AdminFetcherInterface $adminFetcher,
private AdminHelper $helper,
private readonly Environment $twig,
private readonly AdminFetcherInterface $adminFetcher,
private readonly AdminHelper $helper,
) {
}

Expand Down
6 changes: 3 additions & 3 deletions src/Action/DashboardAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ final class DashboardAction
* @param array<array<string, mixed>> $dashboardBlocks
*/
public function __construct(
private array $dashboardBlocks,
private TemplateRegistryInterface $templateRegistry,
private Environment $twig,
private readonly array $dashboardBlocks,
private readonly TemplateRegistryInterface $templateRegistry,
private readonly Environment $twig,
) {
}

Expand Down
4 changes: 2 additions & 2 deletions src/Action/GetShortObjectDescriptionAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
final class GetShortObjectDescriptionAction
{
public function __construct(
private Environment $twig,
private AdminFetcherInterface $adminFetcher,
private readonly Environment $twig,
private readonly AdminFetcherInterface $adminFetcher,
) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/Action/RetrieveAutocompleteItemsAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
final class RetrieveAutocompleteItemsAction
{
public function __construct(
private AdminFetcherInterface $adminFetcher,
private readonly AdminFetcherInterface $adminFetcher,
) {
}

Expand Down
6 changes: 3 additions & 3 deletions src/Action/RetrieveFormFieldElementAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
final class RetrieveFormFieldElementAction
{
public function __construct(
private Environment $twig,
private AdminFetcherInterface $adminFetcher,
private AdminHelper $helper,
private readonly Environment $twig,
private readonly AdminFetcherInterface $adminFetcher,
private readonly AdminHelper $helper,
) {
}

Expand Down
6 changes: 3 additions & 3 deletions src/Action/SearchAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
final class SearchAction
{
public function __construct(
private Pool $pool,
private TemplateRegistryInterface $templateRegistry,
private Environment $twig,
private readonly Pool $pool,
private readonly TemplateRegistryInterface $templateRegistry,
private readonly Environment $twig,
) {
}

Expand Down
12 changes: 6 additions & 6 deletions src/Action/SetObjectFieldValueAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@

final class SetObjectFieldValueAction
{
private RenderElementRuntime $renderElementRuntime;
private readonly RenderElementRuntime $renderElementRuntime;

public function __construct(
private Environment $twig,
private AdminFetcherInterface $adminFetcher,
private ValidatorInterface $validator,
private DataTransformerResolverInterface $resolver,
private PropertyAccessorInterface $propertyAccessor,
private readonly Environment $twig,
private readonly AdminFetcherInterface $adminFetcher,
private readonly ValidatorInterface $validator,
private readonly DataTransformerResolverInterface $resolver,
private readonly PropertyAccessorInterface $propertyAccessor,
?RenderElementRuntime $renderElementRuntime = null,
) {
// NEXT_MAJOR: Remove the deprecation and restrict param constructor to RenderElementRuntime.
Expand Down
2 changes: 1 addition & 1 deletion src/Admin/AdminHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class AdminHelper
private const FORM_FIELD_DELETE = '_delete';

public function __construct(
private PropertyAccessorInterface $propertyAccessor,
private readonly PropertyAccessorInterface $propertyAccessor,
) {
}

Expand Down
6 changes: 3 additions & 3 deletions src/Admin/Pool.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ final class Pool
* @phpstan-param array<string, Group> $adminGroups
*/
public function __construct(
private ContainerInterface $container,
private array $adminServiceCodes = [],
private array $adminGroups = [],
private readonly ContainerInterface $container,
private readonly array $adminServiceCodes = [],
private readonly array $adminGroups = [],
private array $adminClasses = [],
) {
}
Expand Down
2 changes: 1 addition & 1 deletion src/ArgumentResolver/AdminValueResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
final class AdminValueResolver implements CompatibleValueResolverInterface
{
public function __construct(
private AdminFetcherInterface $adminFetcher,
private readonly AdminFetcherInterface $adminFetcher,
) {
}

Expand Down
4 changes: 2 additions & 2 deletions src/Block/AdminListBlockService.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ final class AdminListBlockService extends AbstractBlockService
{
public function __construct(
Environment $twig,
private Pool $pool,
private TemplateRegistryInterface $templateRegistry,
private readonly Pool $pool,
private readonly TemplateRegistryInterface $templateRegistry,
) {
parent::__construct($twig);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Block/AdminPreviewBlockService.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ final class AdminPreviewBlockService extends AbstractBlockService
{
public function __construct(
Environment $twig,
private Pool $pool,
private readonly Pool $pool,
) {
parent::__construct($twig);
}
Expand Down
10 changes: 5 additions & 5 deletions src/Block/AdminSearchBlockService.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ final class AdminSearchBlockService extends AbstractBlockService
*/
public function __construct(
Environment $twig,
private Pool $pool,
private SearchHandlerInterface $searchHandler,
private TemplateRegistryInterface $templateRegistry,
private string $emptyBoxesOption,
private string $adminRoute,
private readonly Pool $pool,
private readonly SearchHandlerInterface $searchHandler,
private readonly TemplateRegistryInterface $templateRegistry,
private readonly string $emptyBoxesOption,
private readonly string $adminRoute,
) {
parent::__construct($twig);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Block/AdminStatsBlockService.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ final class AdminStatsBlockService extends AbstractBlockService
{
public function __construct(
Environment $twig,
private Pool $pool,
private readonly Pool $pool,
) {
parent::__construct($twig);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Bridge/Exporter/AdminExporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
final class AdminExporter
{
public function __construct(
private ExporterInterface $exporter,
private readonly ExporterInterface $exporter,
) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/Command/ExplainAdminCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ final class ExplainAdminCommand extends Command
* @internal This class should only be used through the console
*/
public function __construct(
private Pool $pool,
private readonly Pool $pool,
) {
parent::__construct();
}
Expand Down
4 changes: 2 additions & 2 deletions src/Command/GenerateObjectAclCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ final class GenerateObjectAclCommand extends QuestionableCommand
* @internal This class should only be used through the console
*/
public function __construct(
private Pool $pool,
private readonly Pool $pool,
private array $aclObjectManipulators,
) {
parent::__construct();
Expand Down Expand Up @@ -94,7 +94,7 @@ public function execute(InputInterface $input, OutputInterface $output): int

$securityIdentity = null;
if ($input->getOption('step') && $this->askConfirmation($input, $output, "<question>Set an object owner?</question>\n", 'no')) {
$username = $this->askAndValidate($input, $output, 'Please enter the username: ', '', [Validators::class, 'validateUsername']);
$username = $this->askAndValidate($input, $output, 'Please enter the username: ', '', Validators::validateUsername(...));

$securityIdentity = new UserSecurityIdentity($username, $this->getUserModelClass($input, $output));
}
Expand Down
2 changes: 1 addition & 1 deletion src/Command/ListAdminCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ final class ListAdminCommand extends Command
* @internal This class should only be used through the console
*/
public function __construct(
private Pool $pool,
private readonly Pool $pool,
) {
parent::__construct();
}
Expand Down
4 changes: 2 additions & 2 deletions src/Command/SetupAclCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ final class SetupAclCommand extends Command
* @internal This class should only be used through the console
*/
public function __construct(
private Pool $pool,
private AdminAclManipulatorInterface $aclManipulator,
private readonly Pool $pool,
private readonly AdminAclManipulatorInterface $aclManipulator,
) {
parent::__construct();
}
Expand Down
8 changes: 4 additions & 4 deletions src/Datagrid/Datagrid.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ final class Datagrid implements DatagridInterface
* @phpstan-param PagerInterface<T> $pager
*/
public function __construct(
private ProxyQueryInterface $query,
private FieldDescriptionCollection $columns,
private PagerInterface $pager,
private FormBuilderInterface $formBuilder,
private readonly ProxyQueryInterface $query,
private readonly FieldDescriptionCollection $columns,
private readonly PagerInterface $pager,
private readonly FormBuilderInterface $formBuilder,
private array $values = [],
) {
}
Expand Down
6 changes: 3 additions & 3 deletions src/Datagrid/DatagridMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ final class DatagridMapper implements MapperInterface
* @phpstan-param AdminInterface<T> $admin
*/
public function __construct(
private DatagridBuilderInterface $builder,
private DatagridInterface $datagrid,
private AdminInterface $admin,
private readonly DatagridBuilderInterface $builder,
private readonly DatagridInterface $datagrid,
private readonly AdminInterface $admin,
) {
}

Expand Down
6 changes: 3 additions & 3 deletions src/Datagrid/ListMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ final class ListMapper implements MapperInterface
* @phpstan-param AdminInterface<T> $admin
*/
public function __construct(
private ListBuilderInterface $builder,
private FieldDescriptionCollection $list,
private AdminInterface $admin,
private readonly ListBuilderInterface $builder,
private readonly FieldDescriptionCollection $list,
private readonly AdminInterface $admin,
) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/Event/AdminEventExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
final class AdminEventExtension extends AbstractAdminExtension
{
public function __construct(
private EventDispatcherInterface $eventDispatcher,
private readonly EventDispatcherInterface $eventDispatcher,
) {
}

Expand Down
12 changes: 6 additions & 6 deletions src/Event/BatchActionEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ final class BatchActionEvent extends Event
/**
* @var mixed[]
*/
private array $idx;
private readonly array $idx;

/**
* @param mixed[] $idx
Expand All @@ -45,12 +45,12 @@ final class BatchActionEvent extends Event
* @phpstan-param ProxyQueryInterface<T> $proxyQuery
*/
public function __construct(
private AdminInterface $admin,
private string $type,
private string $actionName,
private ProxyQueryInterface $proxyQuery,
private readonly AdminInterface $admin,
private readonly string $type,
private readonly string $actionName,
private readonly ProxyQueryInterface $proxyQuery,
array &$idx,
private bool $allElements,
private readonly bool $allElements,
) {
$this->idx = &$idx;
}
Expand Down
6 changes: 3 additions & 3 deletions src/Event/ConfigureEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ final class ConfigureEvent extends Event
* @phpstan-param MapperInterface<T> $mapper
*/
public function __construct(
private AdminInterface $admin,
private MapperInterface $mapper,
private string $type,
private readonly AdminInterface $admin,
private readonly MapperInterface $mapper,
private readonly string $type,
) {
}

Expand Down
4 changes: 2 additions & 2 deletions src/Event/ConfigureMenuEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ final class ConfigureMenuEvent extends Event
public const SIDEBAR = 'sonata.admin.event.configure.menu.sidebar';

public function __construct(
private FactoryInterface $factory,
private ItemInterface $menu,
private readonly FactoryInterface $factory,
private readonly ItemInterface $menu,
) {
}

Expand Down
6 changes: 3 additions & 3 deletions src/Event/ConfigureQueryEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ final class ConfigureQueryEvent extends Event
* @param ProxyQueryInterface<object> $proxyQuery
*/
public function __construct(
private AdminInterface $admin,
private ProxyQueryInterface $proxyQuery,
private string $context,
private readonly AdminInterface $admin,
private readonly ProxyQueryInterface $proxyQuery,
private readonly string $context,
) {
}

Expand Down
6 changes: 3 additions & 3 deletions src/Event/PersistenceEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ final class PersistenceEvent extends Event
* @phpstan-param T $object
*/
public function __construct(
private AdminInterface $admin,
private object $object,
private string $type,
private readonly AdminInterface $admin,
private readonly object $object,
private readonly string $type,
) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/Filter/FilterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
final class FilterFactory implements FilterFactoryInterface
{
public function __construct(
private ContainerInterface $container,
private readonly ContainerInterface $container,
) {
}

Expand Down
4 changes: 2 additions & 2 deletions src/Filter/Model/FilterData.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ final class FilterData
* @psalm-suppress ImpureVariable https://github.com/vimeo/psalm/issues/10974
*/
private function __construct(
private ?int $type,
private bool $hasValue,
private readonly ?int $type,
private readonly bool $hasValue,
mixed $value = null,
) {
if ($hasValue) {
Expand Down
2 changes: 1 addition & 1 deletion src/Filter/Persister/SessionFilterPersister.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
final class SessionFilterPersister implements FilterPersisterInterface
{
public function __construct(
private RequestStack $requestStack,
private readonly RequestStack $requestStack,
) {
}

Expand Down
Loading

0 comments on commit 257c183

Please sign in to comment.