Skip to content

Commit a8b93fe

Browse files
committed
Merge remote-tracking branch '37197/feature/php8.1-constructor-property-promotion-send-friend-graph-ql' into blth-del10131-commdashpr
2 parents 006678c + e68f075 commit a8b93fe

File tree

5 files changed

+29
-79
lines changed

5 files changed

+29
-79
lines changed

app/code/Magento/SendFriendGraphQl/Model/Provider/GetVisibleProduct.php

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2019 Adobe
4+
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
77

@@ -18,22 +18,14 @@
1818
*/
1919
class GetVisibleProduct
2020
{
21-
/** @var ProductRepositoryInterface */
22-
private $productRepository;
23-
24-
/** @var Visibility */
25-
private $visibility;
26-
2721
/**
2822
* @param ProductRepositoryInterface $productRepository
2923
* @param Visibility $visibility
3024
*/
3125
public function __construct(
32-
ProductRepositoryInterface $productRepository,
33-
Visibility $visibility
26+
private readonly ProductRepositoryInterface $productRepository,
27+
private readonly Visibility $visibility
3428
) {
35-
$this->productRepository = $productRepository;
36-
$this->visibility = $visibility;
3729
}
3830

3931
/**

app/code/Magento/SendFriendGraphQl/Model/Resolver/SendEmailToFriend.php

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2018 Adobe
4+
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
77

@@ -21,26 +21,14 @@
2121
*/
2222
class SendEmailToFriend implements ResolverInterface
2323
{
24-
/**
25-
* @var SendFriendHelper
26-
*/
27-
private $sendFriendHelper;
28-
29-
/**
30-
* @var SendEmail
31-
*/
32-
private $sendEmail;
33-
3424
/**
3525
* @param SendEmail $sendEmail
3626
* @param SendFriendHelper $sendFriendHelper
3727
*/
3828
public function __construct(
39-
SendEmail $sendEmail,
40-
SendFriendHelper $sendFriendHelper
29+
private readonly SendEmail $sendEmail,
30+
private readonly SendFriendHelper $sendFriendHelper
4131
) {
42-
$this->sendEmail = $sendEmail;
43-
$this->sendFriendHelper = $sendFriendHelper;
4432
}
4533

4634
/**

app/code/Magento/SendFriendGraphQl/Model/Resolver/SendFriendConfiguration.php

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2020 Adobe
4+
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
77

@@ -17,17 +17,12 @@
1717
*/
1818
class SendFriendConfiguration implements ResolverInterface
1919
{
20-
/**
21-
* @var SendFriendHelper
22-
*/
23-
private $sendFriendHelper;
24-
2520
/**
2621
* @param SendFriendHelper $sendFriendHelper
2722
*/
28-
public function __construct(SendFriendHelper $sendFriendHelper)
29-
{
30-
$this->sendFriendHelper = $sendFriendHelper;
23+
public function __construct(
24+
private readonly SendFriendHelper $sendFriendHelper
25+
) {
3126
}
3227

3328
/**

app/code/Magento/SendFriendGraphQl/Model/SendFriend/SendEmail.php

Lines changed: 9 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2018 Adobe
4+
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
77

@@ -11,6 +11,7 @@
1111
use Magento\Catalog\Api\ProductRepositoryInterface;
1212
use Magento\Framework\DataObjectFactory;
1313
use Magento\Framework\Event\ManagerInterface;
14+
use Magento\Framework\Exception\LocalizedException;
1415
use Magento\Framework\Exception\NoSuchEntityException;
1516
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
1617
use Magento\Framework\GraphQl\Exception\GraphQlNoSuchEntityException;
@@ -23,31 +24,6 @@
2324
*/
2425
class SendEmail
2526
{
26-
/**
27-
* @var DataObjectFactory
28-
*/
29-
private $dataObjectFactory;
30-
31-
/**
32-
* @var ProductRepositoryInterface
33-
*/
34-
private $productRepository;
35-
36-
/**
37-
* @var SendFriendFactory
38-
*/
39-
private $sendFriendFactory;
40-
41-
/**
42-
* @var ManagerInterface
43-
*/
44-
private $eventManager;
45-
46-
/**
47-
* @var GetVisibleProduct
48-
*/
49-
private $visibleProductProvider;
50-
5127
/**
5228
* SendEmail constructor.
5329
* @param DataObjectFactory $dataObjectFactory
@@ -57,17 +33,12 @@ class SendEmail
5733
* @param GetVisibleProduct $visibleProductProvider
5834
*/
5935
public function __construct(
60-
DataObjectFactory $dataObjectFactory,
61-
ProductRepositoryInterface $productRepository,
62-
SendFriendFactory $sendFriendFactory,
63-
ManagerInterface $eventManager,
64-
GetVisibleProduct $visibleProductProvider
36+
private readonly DataObjectFactory $dataObjectFactory,
37+
private readonly ProductRepositoryInterface $productRepository,
38+
private readonly SendFriendFactory $sendFriendFactory,
39+
private readonly ManagerInterface $eventManager,
40+
private readonly GetVisibleProduct $visibleProductProvider
6541
) {
66-
$this->dataObjectFactory = $dataObjectFactory;
67-
$this->productRepository = $productRepository;
68-
$this->sendFriendFactory = $sendFriendFactory;
69-
$this->eventManager = $eventManager;
70-
$this->visibleProductProvider = $visibleProductProvider;
7142
}
7243

7344
/**
@@ -78,7 +49,7 @@ public function __construct(
7849
* @param array $recipientsData
7950
* @throws GraphQlInputException
8051
* @throws GraphQlNoSuchEntityException
81-
* @throws \Magento\Framework\Exception\LocalizedException
52+
* @throws LocalizedException
8253
*/
8354
public function execute(int $productId, array $senderData, array $recipientsData): void
8455
{
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2015 Adobe
4+
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
77

88
use Magento\Framework\Component\ComponentRegistrar;
99

10-
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_SendFriendGraphQl', __DIR__);
10+
ComponentRegistrar::register(
11+
ComponentRegistrar::MODULE,
12+
'Magento_SendFriendGraphQl',
13+
__DIR__
14+
);

0 commit comments

Comments
 (0)