Skip to content

Commit 4415063

Browse files
committed
Automated changes: Rector + CSFixer
1 parent d265d15 commit 4415063

File tree

61 files changed

+474
-540
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+474
-540
lines changed

code_samples/ai_actions/src/Command/ActionConfigurationCreateCommand.php

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,33 +15,26 @@
1515
use Ibexa\Contracts\Core\Repository\UserService;
1616
use Symfony\Component\Console\Attribute\AsCommand;
1717
use Symfony\Component\Console\Command\Command;
18-
use Symfony\Component\Console\Input\InputArgument;
19-
use Symfony\Component\Console\Input\InputInterface;
2018
use Symfony\Component\Console\Output\OutputInterface;
2119

2220
#[AsCommand(
2321
name: 'app:action-configuration-create'
2422
)]
25-
final class ActionConfigurationCreateCommand extends Command
23+
final readonly class ActionConfigurationCreateCommand
2624
{
2725
public function __construct(
28-
private readonly ActionConfigurationServiceInterface $actionConfigurationService,
29-
private readonly PermissionResolver $permissionResolver,
30-
private readonly UserService $userService,
31-
private readonly ActionServiceInterface $actionService,
32-
private readonly ActionTypeRegistryInterface $actionTypeRegistry
26+
private ActionConfigurationServiceInterface $actionConfigurationService,
27+
private PermissionResolver $permissionResolver,
28+
private UserService $userService,
29+
private ActionServiceInterface $actionService,
30+
private ActionTypeRegistryInterface $actionTypeRegistry
3331
) {
34-
parent::__construct();
3532
}
3633

37-
protected function configure(): void
34+
public function __invoke(#[\Symfony\Component\Console\Attribute\Argument(name: 'user', description: 'Login of the user executing the actions')]
35+
?string $user, OutputInterface $output): int
3836
{
39-
$this->addArgument('user', InputArgument::OPTIONAL, 'Login of the user executing the actions', 'admin');
40-
}
41-
42-
protected function execute(InputInterface $input, OutputInterface $output): int
43-
{
44-
$user = $input->getArgument('user');
37+
$user = $user;
4538
$this->permissionResolver->setCurrentUserReference($this->userService->loadUserByLogin($user));
4639

4740
$refineTextActionType = $this->actionTypeRegistry->getActionType('refine_text');

code_samples/ai_actions/src/Command/AddMissingAltTextCommand.php

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,36 +24,29 @@
2424
use Ibexa\Core\IO\IOBinarydataHandler;
2525
use Symfony\Component\Console\Attribute\AsCommand;
2626
use Symfony\Component\Console\Command\Command;
27-
use Symfony\Component\Console\Input\InputArgument;
28-
use Symfony\Component\Console\Input\InputInterface;
2927
use Symfony\Component\Console\Output\OutputInterface;
3028

3129
#[AsCommand(
3230
name: 'app:add-alt-text',
3331
)]
34-
final class AddMissingAltTextCommand extends Command
32+
final readonly class AddMissingAltTextCommand
3533
{
3634
private const string IMAGE_FIELD_IDENTIFIER = 'image';
3735

3836
public function __construct(
39-
private readonly ContentService $contentService,
40-
private readonly PermissionResolver $permissionResolver,
41-
private readonly UserService $userService,
42-
private readonly FieldTypeService $fieldTypeService,
43-
private readonly ActionServiceInterface $actionService,
44-
private readonly IOBinarydataHandler $binaryDataHandler
37+
private ContentService $contentService,
38+
private PermissionResolver $permissionResolver,
39+
private UserService $userService,
40+
private FieldTypeService $fieldTypeService,
41+
private ActionServiceInterface $actionService,
42+
private IOBinarydataHandler $binaryDataHandler
4543
) {
46-
parent::__construct();
4744
}
4845

49-
protected function configure(): void
46+
public function __invoke(#[\Symfony\Component\Console\Attribute\Argument(name: 'user', description: 'Login of the user executing the actions')]
47+
?string $user, OutputInterface $output): int
5048
{
51-
$this->addArgument('user', InputArgument::OPTIONAL, 'Login of the user executing the actions', 'admin');
52-
}
53-
54-
protected function execute(InputInterface $input, OutputInterface $output): int
55-
{
56-
$this->setUser($input->getArgument('user'));
49+
$this->setUser($user);
5750

5851
$modifiedImages = $this->getModifiedImages();
5952
$output->writeln(sprintf('Found %d modified image in the last 24h', $modifiedImages->getTotalCount()));

code_samples/api/commerce/src/Command/CartCommand.php

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,28 +19,26 @@
1919
use Ibexa\Core\Repository\Permission\PermissionResolver;
2020
use Symfony\Component\Console\Attribute\AsCommand;
2121
use Symfony\Component\Console\Command\Command;
22-
use Symfony\Component\Console\Input\InputInterface;
2322
use Symfony\Component\Console\Output\OutputInterface;
2423

2524
#[AsCommand(
2625
name: 'doc:cart'
2726
)]
28-
final class CartCommand extends Command
27+
final readonly class CartCommand
2928
{
3029
public function __construct(
31-
private readonly PermissionResolver $permissionResolver,
32-
private readonly UserService $userService,
33-
private readonly CartServiceInterface $cartService,
34-
private readonly CurrencyServiceInterface $currencyService,
35-
private readonly ProductServiceInterface $productService,
36-
private readonly OrderServiceInterface $orderService,
37-
private readonly ReorderService $reorderService,
38-
private readonly CartResolverInterface $cartResolver
30+
private PermissionResolver $permissionResolver,
31+
private UserService $userService,
32+
private CartServiceInterface $cartService,
33+
private CurrencyServiceInterface $currencyService,
34+
private ProductServiceInterface $productService,
35+
private OrderServiceInterface $orderService,
36+
private ReorderService $reorderService,
37+
private CartResolverInterface $cartResolver
3938
) {
40-
parent::__construct();
4139
}
4240

43-
protected function execute(InputInterface $input, OutputInterface $output): int
41+
public function __invoke(OutputInterface $output): int
4442
{
4543
$this->permissionResolver->setCurrentUserReference(
4644
$this->userService->loadUserByLogin('admin')
@@ -138,6 +136,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
138136
// Merge the carts into the target cart and delete the merged carts
139137
$reorderCart = $this->cartService->mergeCarts($reorderCart, true, $existingCart);
140138

141-
return self::SUCCESS;
139+
return Command::SUCCESS;
142140
}
143141
}

code_samples/api/commerce/src/Command/OrderCommand.php

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,27 +23,21 @@
2323
use Money;
2424
use Symfony\Component\Console\Attribute\AsCommand;
2525
use Symfony\Component\Console\Command\Command;
26-
use Symfony\Component\Console\Input\InputInterface;
2726
use Symfony\Component\Console\Output\OutputInterface;
2827

2928
#[AsCommand(
3029
name: 'doc:order'
3130
)]
32-
final class OrderCommand extends Command
31+
final readonly class OrderCommand
3332
{
3433
public function __construct(
35-
private readonly PermissionResolver $permissionResolver,
36-
private readonly UserService $userService,
37-
private readonly OrderServiceInterface $orderService
34+
private PermissionResolver $permissionResolver,
35+
private UserService $userService,
36+
private OrderServiceInterface $orderService
3837
) {
39-
parent::__construct();
4038
}
4139

42-
public function configure(): void
43-
{
44-
}
45-
46-
protected function execute(InputInterface $input, OutputInterface $output): int
40+
public function __invoke(OutputInterface $output): int
4741
{
4842
$currentUser = $this->userService->loadUserByLogin('admin');
4943
$this->permissionResolver->setCurrentUserReference($currentUser);
@@ -118,6 +112,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
118112

119113
$output->writeln(sprintf('Found %d orders with provided criteria', count($orders)));
120114

121-
return self::SUCCESS;
115+
return Command::SUCCESS;
122116
}
123117
}

code_samples/api/commerce/src/Command/PaymentCommand.php

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,23 @@
1818
use Money;
1919
use Symfony\Component\Console\Attribute\AsCommand;
2020
use Symfony\Component\Console\Command\Command;
21-
use Symfony\Component\Console\Input\InputInterface;
2221
use Symfony\Component\Console\Output\OutputInterface;
2322

2423
#[AsCommand(
2524
name: 'doc:payment'
2625
)]
27-
final class PaymentCommand extends Command
26+
final readonly class PaymentCommand
2827
{
2928
public function __construct(
30-
private readonly PermissionResolver $permissionResolver,
31-
private readonly UserService $userService,
32-
private readonly PaymentServiceInterface $paymentService,
33-
private readonly OrderServiceInterface $orderService,
34-
private readonly PaymentMethodServiceInterface $paymentMethodService,
29+
private PermissionResolver $permissionResolver,
30+
private UserService $userService,
31+
private PaymentServiceInterface $paymentService,
32+
private OrderServiceInterface $orderService,
33+
private PaymentMethodServiceInterface $paymentMethodService
3534
) {
36-
parent::__construct();
3735
}
3836

39-
public function configure(): void
40-
{
41-
}
42-
43-
protected function execute(InputInterface $input, OutputInterface $output): int
37+
public function __invoke(OutputInterface $output): int
4438
{
4539
$currentUser = $this->userService->loadUserByLogin('admin');
4640
$this->permissionResolver->setCurrentUserReference($currentUser);
@@ -105,6 +99,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
10599
// Delete existing payment permanently
106100
$this->paymentService->deletePayment($payment);
107101

108-
return self::SUCCESS;
102+
return Command::SUCCESS;
109103
}
110104
}

code_samples/api/commerce/src/Command/PaymentMethodCommand.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,21 @@
1616
use Ibexa\Payment\Values\PaymentMethodType;
1717
use Symfony\Component\Console\Attribute\AsCommand;
1818
use Symfony\Component\Console\Command\Command;
19-
use Symfony\Component\Console\Input\InputInterface;
2019
use Symfony\Component\Console\Output\OutputInterface;
2120

2221
#[AsCommand(
2322
name: 'doc:paymentMethod'
2423
)]
25-
final class PaymentMethodCommand extends Command
24+
final readonly class PaymentMethodCommand
2625
{
2726
public function __construct(
28-
private readonly PermissionResolver $permissionResolver,
29-
private readonly UserService $userService,
30-
private readonly PaymentMethodServiceInterface $paymentMethodService
27+
private PermissionResolver $permissionResolver,
28+
private UserService $userService,
29+
private PaymentMethodServiceInterface $paymentMethodService
3130
) {
32-
parent::__construct();
3331
}
3432

35-
protected function execute(InputInterface $input, OutputInterface $output): int
33+
public function __invoke(OutputInterface $output): int
3634
{
3735
$currentUser = $this->userService->loadUserByLogin('admin');
3836
$this->permissionResolver->setCurrentUserReference($currentUser);
@@ -115,6 +113,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
115113
));
116114
}
117115

118-
return self::SUCCESS;
116+
return Command::SUCCESS;
119117
}
120118
}

code_samples/api/commerce/src/Command/ShipmentCommand.php

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,23 @@
1919
use Money;
2020
use Symfony\Component\Console\Attribute\AsCommand;
2121
use Symfony\Component\Console\Command\Command;
22-
use Symfony\Component\Console\Input\InputInterface;
2322
use Symfony\Component\Console\Output\OutputInterface;
2423

2524
#[AsCommand(
2625
name: 'doc:shipment'
2726
)]
28-
final class ShipmentCommand extends Command
27+
final readonly class ShipmentCommand
2928
{
3029
public function __construct(
31-
private readonly PermissionResolver $permissionResolver,
32-
private readonly UserService $userService,
33-
private readonly ShipmentServiceInterface $shipmentService,
34-
private readonly ShippingMethodServiceInterface $shippingMethodService,
35-
private readonly OrderServiceInterface $orderService
30+
private PermissionResolver $permissionResolver,
31+
private UserService $userService,
32+
private ShipmentServiceInterface $shipmentService,
33+
private ShippingMethodServiceInterface $shippingMethodService,
34+
private OrderServiceInterface $orderService
3635
) {
37-
parent::__construct();
3836
}
3937

40-
protected function execute(InputInterface $input, OutputInterface $output): int
38+
public function __invoke(OutputInterface $output): int
4139
{
4240
$currentUser = $this->userService->loadUserByLogin('admin');
4341
$this->permissionResolver->setCurrentUserReference($currentUser);
@@ -118,6 +116,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
118116
// Delete existing shipment permanently
119117
$this->shipmentService->deleteShipment($shipment);
120118

121-
return self::SUCCESS;
119+
return Command::SUCCESS;
122120
}
123121
}

code_samples/api/commerce/src/Command/ShippingMethodCommand.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,22 @@
1515
use Ibexa\Shipping\Value\ShippingMethodType;
1616
use Symfony\Component\Console\Attribute\AsCommand;
1717
use Symfony\Component\Console\Command\Command;
18-
use Symfony\Component\Console\Input\InputInterface;
1918
use Symfony\Component\Console\Output\OutputInterface;
2019

2120
#[AsCommand(
2221
name: 'doc:shippingMethod'
2322
)]
24-
final class ShippingMethodCommand extends Command
23+
final readonly class ShippingMethodCommand
2524
{
2625
public function __construct(
27-
private readonly PermissionResolver $permissionResolver,
28-
private readonly UserService $userService,
29-
private readonly ShippingMethodServiceInterface $shippingMethodService,
30-
private readonly RegionServiceInterface $regionService
26+
private PermissionResolver $permissionResolver,
27+
private UserService $userService,
28+
private ShippingMethodServiceInterface $shippingMethodService,
29+
private RegionServiceInterface $regionService
3130
) {
32-
parent::__construct();
3331
}
3432

35-
protected function execute(InputInterface $input, OutputInterface $output): int
33+
public function __invoke(OutputInterface $output): int
3634
{
3735
$currentUser = $this->userService->loadUserByLogin('admin');
3836
$this->permissionResolver->setCurrentUserReference($currentUser);
@@ -141,6 +139,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
141139
$languageCode
142140
));
143141

144-
return self::SUCCESS;
142+
return Command::SUCCESS;
145143
}
146144
}

code_samples/api/migration/src/Command/MigrationCommand.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,18 @@
66
use Ibexa\Migration\Repository\Migration;
77
use Symfony\Component\Console\Attribute\AsCommand;
88
use Symfony\Component\Console\Command\Command;
9-
use Symfony\Component\Console\Input\InputInterface;
109
use Symfony\Component\Console\Output\OutputInterface;
1110

1211
#[AsCommand(
1312
name: 'doc:migration'
1413
)]
15-
final class MigrationCommand extends Command
14+
final readonly class MigrationCommand
1615
{
17-
public function __construct(private readonly MigrationService $migrationService)
16+
public function __construct(private MigrationService $migrationService)
1817
{
19-
parent::__construct();
2018
}
2119

22-
protected function execute(InputInterface $input, OutputInterface $output): int
20+
public function __invoke(OutputInterface $output): int
2321
{
2422
$string_with_migration_content = '';
2523
$this->migrationService->add(
@@ -39,6 +37,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
3937
$this->migrationService->executeOne($my_migration);
4038
$this->migrationService->executeAll('admin');
4139

42-
return self::SUCCESS;
40+
return Command::SUCCESS;
4341
}
4442
}

0 commit comments

Comments
 (0)