Skip to content

Commit 4afb98f

Browse files
committed
Manual fixes
1 parent 4415063 commit 4afb98f

39 files changed

+229
-480
lines changed

.php-cs-fixer.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
$configFactory = new InternalConfigFactory();
1212
$configFactory->withRules([
1313
'header_comment' => false,
14+
'method_argument_space' => [
15+
'attribute_placement' => 'same_line'
16+
]
1417
]);
1518

1619
return $configFactory

code_samples/ai_actions/src/Command/ActionConfigurationCreateCommand.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Ibexa\Contracts\Core\Collection\ArrayMap;
1414
use Ibexa\Contracts\Core\Repository\PermissionResolver;
1515
use Ibexa\Contracts\Core\Repository\UserService;
16+
use Symfony\Component\Console\Attribute\Argument;
1617
use Symfony\Component\Console\Attribute\AsCommand;
1718
use Symfony\Component\Console\Command\Command;
1819
use Symfony\Component\Console\Output\OutputInterface;
@@ -31,9 +32,10 @@ public function __construct(
3132
) {
3233
}
3334

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
36-
{
35+
public function __invoke(
36+
#[Argument(name: 'user', description: 'Login of the user executing the actions')] string $user,
37+
OutputInterface $output
38+
): int {
3739
$user = $user;
3840
$this->permissionResolver->setCurrentUserReference($this->userService->loadUserByLogin($user));
3941

code_samples/ai_actions/src/Command/AddMissingAltTextCommand.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
use Ibexa\Contracts\Core\Repository\Values\Filter\Filter;
2323
use Ibexa\Core\FieldType\Image\Value;
2424
use Ibexa\Core\IO\IOBinarydataHandler;
25+
use Symfony\Component\Console\Attribute\Argument;
2526
use Symfony\Component\Console\Attribute\AsCommand;
2627
use Symfony\Component\Console\Command\Command;
2728
use Symfony\Component\Console\Output\OutputInterface;
@@ -43,9 +44,10 @@ public function __construct(
4344
) {
4445
}
4546

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
48-
{
47+
public function __invoke(
48+
#[Argument(name: 'user', description: 'Login of the user executing the actions')] string $user,
49+
OutputInterface $output
50+
): int {
4951
$this->setUser($user);
5052

5153
$modifiedImages = $this->getModifiedImages();

code_samples/api/product_catalog/src/Command/CatalogCommand.php

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
use Ibexa\Contracts\ProductCatalog\Values\Product\ProductQuery;
1414
use Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion;
1515
use Ibexa\ProductCatalog\Local\Repository\Values\Catalog\Status;
16+
use Symfony\Component\Console\Attribute\Argument;
1617
use Symfony\Component\Console\Attribute\AsCommand;
1718
use Symfony\Component\Console\Command\Command;
18-
use Symfony\Component\Console\Input\InputArgument;
1919
use Symfony\Component\Console\Output\OutputInterface;
2020

2121
#[AsCommand(
@@ -31,21 +31,13 @@ public function __construct(
3131
) {
3232
}
3333

34-
public function configure(): void
35-
{
36-
$this
37-
->setDefinition([
38-
new InputArgument('catalogIdentifier', InputArgument::REQUIRED, 'Catalog identifier'),
39-
]);
40-
}
41-
42-
public function __invoke(OutputInterface $output): int
43-
{
34+
public function __invoke(
35+
OutputInterface $output,
36+
#[Argument(description: 'Catalog identifier')] string $catalogIdentifier
37+
): int {
4438
$user = $this->userService->loadUserByLogin('admin');
4539
$this->permissionResolver->setCurrentUserReference($user);
4640

47-
$catalogIdentifier = $catalogIdentifier;
48-
4941
// Create catalog
5042
$catalogCriterion = new Criterion\LogicalAnd(
5143
[

code_samples/api/product_catalog/src/Command/CurrencyCommand.php

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
use Ibexa\Contracts\ProductCatalog\CurrencyServiceInterface;
88
use Ibexa\Contracts\ProductCatalog\Values\Currency\CurrencyCreateStruct;
99
use Ibexa\Contracts\ProductCatalog\Values\Currency\CurrencyUpdateStruct;
10+
use Symfony\Component\Console\Attribute\Argument;
1011
use Symfony\Component\Console\Attribute\AsCommand;
1112
use Symfony\Component\Console\Command\Command;
12-
use Symfony\Component\Console\Input\InputArgument;
1313
use Symfony\Component\Console\Output\OutputInterface;
1414

1515
#[AsCommand(
@@ -24,23 +24,14 @@ public function __construct(
2424
) {
2525
}
2626

27-
public function configure(): void
28-
{
29-
$this
30-
->setDefinition([
31-
new InputArgument('currencyCode', InputArgument::REQUIRED, 'Currency code'),
32-
new InputArgument('newCurrencyCode', InputArgument::REQUIRED, 'New currency code'),
33-
]);
34-
}
35-
36-
public function __invoke(OutputInterface $output): int
37-
{
27+
public function __invoke(
28+
OutputInterface $output,
29+
#[Argument(description: 'Currency code')] string $currencyCode,
30+
#[Argument(description: 'New currency code')] string $newCurrencyCode
31+
): int {
3832
$user = $this->userService->loadUserByLogin('admin');
3933
$this->permissionResolver->setCurrentUserReference($user);
4034

41-
$currencyCode = $currencyCode;
42-
$newCurrencyCode = $newCurrencyCode;
43-
4435
$currency = $this->currencyService->getCurrencyByCode($currencyCode);
4536
$output->writeln('Currency ID: ' . $currency->getId());
4637

@@ -56,6 +47,7 @@ public function __invoke(OutputInterface $output): int
5647

5748
$this->currencyService->updateCurrency($currency, $currencyUpdateStruct);
5849

50+
assert($newCurrencyCode !== '', 'Currency code cannot be empty');
5951
$currencyCreateStruct = new CurrencyCreateStruct($newCurrencyCode, 2, true);
6052

6153
$this->currencyService->createCurrency($currencyCreateStruct);

code_samples/api/product_catalog/src/Command/ProductAssetCommand.php

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
use Ibexa\Contracts\Core\Repository\UserService;
99
use Ibexa\Contracts\ProductCatalog\AssetServiceInterface;
1010
use Ibexa\Contracts\ProductCatalog\ProductServiceInterface;
11+
use Symfony\Component\Console\Attribute\Argument;
1112
use Symfony\Component\Console\Attribute\AsCommand;
1213
use Symfony\Component\Console\Command\Command;
13-
use Symfony\Component\Console\Input\InputArgument;
1414
use Symfony\Component\Console\Output\OutputInterface;
1515

1616
#[AsCommand(
@@ -26,20 +26,13 @@ public function __construct(
2626
) {
2727
}
2828

29-
public function configure(): void
30-
{
31-
$this
32-
->setDefinition([
33-
new InputArgument('productCode', InputArgument::REQUIRED, 'Product code'),
34-
]);
35-
}
36-
37-
public function __invoke(OutputInterface $output): int
38-
{
29+
public function __invoke(
30+
OutputInterface $output,
31+
#[Argument(description: 'Product code')] string $productCode
32+
): int {
3933
$user = $this->userService->loadUserByLogin('admin');
4034
$this->permissionResolver->setCurrentUserReference($user);
4135

42-
$productCode = $productCode;
4336
$product = $this->productService->getProduct($productCode);
4437

4538
$singleAsset = $this->assetService->getAsset($product, '1');

code_samples/api/product_catalog/src/Command/ProductCommand.php

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
use Ibexa\Contracts\ProductCatalog\Values\Product\ProductQuery;
1414
use Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion;
1515
use Ibexa\Contracts\ProductCatalog\Values\Product\Query\SortClause;
16+
use Symfony\Component\Console\Attribute\Argument;
1617
use Symfony\Component\Console\Attribute\AsCommand;
1718
use Symfony\Component\Console\Command\Command;
18-
use Symfony\Component\Console\Input\InputArgument;
1919
use Symfony\Component\Console\Output\OutputInterface;
2020

2121
#[AsCommand(
@@ -33,23 +33,14 @@ public function __construct(
3333
) {
3434
}
3535

36-
public function configure(): void
37-
{
38-
$this
39-
->setDefinition([
40-
new InputArgument('productCode', InputArgument::REQUIRED, 'Product code'),
41-
new InputArgument('productType', InputArgument::REQUIRED, 'Product type'),
42-
]);
43-
}
44-
45-
public function __invoke(OutputInterface $output): int
46-
{
36+
public function __invoke(
37+
OutputInterface $output,
38+
#[Argument(description: 'Product code')] string $productCode,
39+
#[Argument(description: 'Product type')] string $productType
40+
): int {
4741
$user = $this->userService->loadUserByLogin('admin');
4842
$this->permissionResolver->setCurrentUserReference($user);
4943

50-
$productCode = $productCode;
51-
$productType = $productType;
52-
5344
$product = $this->productService->getProduct($productCode);
5445

5546
$output->writeln('Product with code ' . $product->getCode() . ' is ' . $product->getName());

code_samples/api/product_catalog/src/Command/ProductPriceCommand.php

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
use Ibexa\Contracts\ProductCatalog\Values\Price\Query\Criterion\LogicalOr;
1717
use Ibexa\Contracts\ProductCatalog\Values\Price\Query\Criterion\Product;
1818
use Money;
19+
use Symfony\Component\Console\Attribute\Argument;
1920
use Symfony\Component\Console\Attribute\AsCommand;
2021
use Symfony\Component\Console\Command\Command;
21-
use Symfony\Component\Console\Input\InputArgument;
2222
use Symfony\Component\Console\Output\OutputInterface;
2323

2424
#[AsCommand(
@@ -36,24 +36,16 @@ public function __construct(
3636
) {
3737
}
3838

39-
public function configure(): void
40-
{
41-
$this
42-
->setDefinition([
43-
new InputArgument('productCode', InputArgument::REQUIRED, 'Product code'),
44-
new InputArgument('currencyCode', InputArgument::REQUIRED, 'Currency code'),
45-
new InputArgument('newCurrencyCode', InputArgument::REQUIRED, 'New currency code'),
46-
]);
47-
}
48-
49-
public function __invoke(OutputInterface $output): int
50-
{
39+
public function __invoke(
40+
OutputInterface $output,
41+
#[Argument(description: 'Product code')] string $productCode,
42+
#[Argument(description: 'Currency code')] string $currencyCode,
43+
#[Argument(description: 'New currency code')] string $newCurrencyCode
44+
): int {
5145
$user = $this->userService->loadUserByLogin('admin');
5246
$this->permissionResolver->setCurrentUserReference($user);
5347

54-
$productCode = $productCode;
5548
$product = $this->productService->getProduct($productCode);
56-
$currencyCode = $currencyCode;
5749
$currency = $this->currencyService->getCurrencyByCode($currencyCode);
5850

5951
$productPrice = $product->getPrice();
@@ -64,9 +56,9 @@ public function __invoke(OutputInterface $output): int
6456

6557
$output->writeln('Price for ' . $product->getName() . ' in ' . $currencyCode . ' is ' . $productPrice);
6658

67-
$newCurrencyCode = $newCurrencyCode;
6859
$newCurrency = $this->currencyService->getCurrencyByCode($newCurrencyCode);
6960

61+
assert($newCurrencyCode !== '', 'Currency code cannot be empty');
7062
$money = new Money\Money(50000, new Money\Currency($newCurrencyCode));
7163
$priceCreateStruct = new ProductPriceCreateStruct($product, $newCurrency, $money, null, null);
7264

code_samples/api/product_catalog/src/Command/ProductTypeCommand.php

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
use Ibexa\Contracts\Core\Repository\PermissionResolver;
66
use Ibexa\Contracts\Core\Repository\UserService;
77
use Ibexa\Contracts\ProductCatalog\ProductTypeServiceInterface;
8+
use Symfony\Component\Console\Attribute\Argument;
89
use Symfony\Component\Console\Attribute\AsCommand;
910
use Symfony\Component\Console\Command\Command;
10-
use Symfony\Component\Console\Input\InputArgument;
1111
use Symfony\Component\Console\Output\OutputInterface;
1212

1313
#[AsCommand(
@@ -22,21 +22,13 @@ public function __construct(
2222
) {
2323
}
2424

25-
public function configure(): void
26-
{
27-
$this
28-
->setDefinition([
29-
new InputArgument('productTypeIdentifier', InputArgument::REQUIRED, 'Product type identifier'),
30-
]);
31-
}
32-
33-
public function __invoke(OutputInterface $output): int
34-
{
25+
public function __invoke(
26+
OutputInterface $output,
27+
#[Argument(description: 'Product type identifier')] string $productTypeIdentifier
28+
): int {
3529
$user = $this->userService->loadUserByLogin('admin');
3630
$this->permissionResolver->setCurrentUserReference($user);
3731

38-
$productTypeIdentifier = $productTypeIdentifier;
39-
4032
$productType = $this->productTypeService->getProductType($productTypeIdentifier);
4133

4234
$output->writeln($productType->getName());

code_samples/api/product_catalog/src/Command/ProductVariantCommand.php

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
use Ibexa\Contracts\ProductCatalog\Local\Values\Product\ProductVariantCreateStruct;
1111
use Ibexa\Contracts\ProductCatalog\ProductServiceInterface;
1212
use Ibexa\Contracts\ProductCatalog\Values\Product\ProductVariantQuery;
13+
use Symfony\Component\Console\Attribute\Argument;
1314
use Symfony\Component\Console\Attribute\AsCommand;
1415
use Symfony\Component\Console\Command\Command;
15-
use Symfony\Component\Console\Input\InputArgument;
1616
use Symfony\Component\Console\Output\OutputInterface;
1717

1818
#[AsCommand(
@@ -28,20 +28,13 @@ public function __construct(
2828
) {
2929
}
3030

31-
public function configure(): void
32-
{
33-
$this
34-
->setDefinition([
35-
new InputArgument('productCode', InputArgument::REQUIRED, 'Product code'),
36-
]);
37-
}
38-
39-
public function __invoke(OutputInterface $output): int
40-
{
31+
public function __invoke(
32+
OutputInterface $output,
33+
#[Argument(description: 'Product code')] string $productCode
34+
): int {
4135
$user = $this->userService->loadUserByLogin('admin');
4236
$this->permissionResolver->setCurrentUserReference($user);
4337

44-
$productCode = $productCode;
4538
$product = $this->productService->getProduct($productCode);
4639

4740
// Get variants

0 commit comments

Comments
 (0)