Skip to content

Commit eebf603

Browse files
authored
ENGCOM-4676: Partial docs fixes in Newsletter module #20848
2 parents d1f7b97 + 386d86d commit eebf603

File tree

5 files changed

+28
-17
lines changed

5 files changed

+28
-17
lines changed

app/code/Magento/Newsletter/Block/Adminhtml/Problem.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function __construct(
4141
}
4242

4343
/**
44-
* @return void
44+
* @inheritDoc
4545
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
4646
*/
4747
protected function _construct()
@@ -83,7 +83,7 @@ protected function _prepareLayout()
8383
/**
8484
* Get the html element for unsubscribe button
8585
*
86-
* @return $string
86+
* @return string
8787
*/
8888
public function getUnsubscribeButtonHtml()
8989
{
@@ -93,7 +93,7 @@ public function getUnsubscribeButtonHtml()
9393
/**
9494
* Get the html element for delete button
9595
*
96-
* @return $string
96+
* @return string
9797
*/
9898
public function getDeleteButtonHtml()
9999
{

app/code/Magento/Newsletter/Controller/Adminhtml/Subscriber/MassDelete.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,27 @@
66
*/
77
namespace Magento\Newsletter\Controller\Adminhtml\Subscriber;
88

9-
use Magento\Newsletter\Controller\Adminhtml\Subscriber;
109
use Magento\Backend\App\Action\Context;
10+
use Magento\Framework\App\Action\HttpPostActionInterface;
11+
use Magento\Framework\App\ObjectManager;
1112
use Magento\Framework\App\Response\Http\FileFactory;
13+
use Magento\Newsletter\Controller\Adminhtml\Subscriber;
1214
use Magento\Newsletter\Model\SubscriberFactory;
13-
use Magento\Framework\App\ObjectManager;
1415

15-
class MassDelete extends Subscriber
16+
/**
17+
* Subscriber mass delete controller.
18+
*/
19+
class MassDelete extends Subscriber implements HttpPostActionInterface
1620
{
1721
/**
1822
* @var SubscriberFactory
1923
*/
2024
private $subscriberFactory;
21-
25+
2226
/**
2327
* @param Context $context
2428
* @param FileFactory $fileFactory
29+
* @param SubscriberFactory|null $subscriberFactory
2530
*/
2631
public function __construct(
2732
Context $context,
@@ -31,7 +36,7 @@ public function __construct(
3136
$this->subscriberFactory = $subscriberFactory ?: ObjectManager::getInstance()->get(SubscriberFactory::class);
3237
parent::__construct($context, $fileFactory);
3338
}
34-
39+
3540
/**
3641
* Delete one or more subscribers action
3742
*

app/code/Magento/Newsletter/Controller/Manage/Save.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
67

78
namespace Magento\Newsletter\Controller\Manage;
89

910
use Magento\Customer\Api\CustomerRepositoryInterface as CustomerRepository;
10-
use Magento\Customer\Model\Customer;
11+
use Magento\Customer\Api\Data\CustomerInterface;
1112
use Magento\Framework\App\Action\HttpGetActionInterface;
1213
use Magento\Framework\App\Action\HttpPostActionInterface;
1314
use Magento\Newsletter\Model\Subscriber;
@@ -65,7 +66,7 @@ public function __construct(
6566
/**
6667
* Save newsletter subscription preference action
6768
*
68-
* @return void|null
69+
* @return \Magento\Framework\App\ResponseInterface
6970
*/
7071
public function execute()
7172
{
@@ -110,16 +111,16 @@ public function execute()
110111
$this->messageManager->addError(__('Something went wrong while saving your subscription.'));
111112
}
112113
}
113-
$this->_redirect('customer/account/');
114+
return $this->_redirect('customer/account/');
114115
}
115116

116117
/**
117118
* Set ignore_validation_flag to skip unnecessary address and customer validation
118119
*
119-
* @param Customer $customer
120+
* @param CustomerInterface $customer
120121
* @return void
121122
*/
122-
private function setIgnoreValidationFlag($customer)
123+
private function setIgnoreValidationFlag(CustomerInterface $customer): void
123124
{
124125
$customer->setData('ignore_validation_flag', true);
125126
}

app/code/Magento/Newsletter/Controller/Subscriber/Confirm.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* Copyright © Magento, Inc. All rights reserved.
55
* See COPYING.txt for license details.
66
*/
7+
declare(strict_types=1);
78

89
namespace Magento\Newsletter\Controller\Subscriber;
910

app/code/Magento/Newsletter/Model/Subscriber.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77

88
use Magento\Customer\Api\AccountManagementInterface;
99
use Magento\Customer\Api\CustomerRepositoryInterface;
10-
use Magento\Framework\Exception\MailException;
11-
use Magento\Framework\Exception\NoSuchEntityException;
1210
use Magento\Customer\Api\Data\CustomerInterfaceFactory;
1311
use Magento\Framework\Api\DataObjectHelper;
1412
use Magento\Framework\App\ObjectManager;
13+
use Magento\Framework\Exception\MailException;
14+
use Magento\Framework\Exception\NoSuchEntityException;
1515

1616
/**
1717
* Subscriber model
@@ -31,6 +31,7 @@
3131
* @method int getSubscriberId()
3232
* @method Subscriber setSubscriberId(int $value)
3333
*
34+
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
3435
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
3536
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
3637
*
@@ -402,6 +403,7 @@ public function loadByCustomerId($customerId)
402403
$this->setSubscriberConfirmCode($this->randomSequence());
403404
$this->save();
404405
}
406+
// phpcs:ignore Magento2.CodeAnalysis.EmptyBlock
405407
} catch (NoSuchEntityException $e) {
406408
}
407409
return $this;
@@ -493,7 +495,9 @@ public function subscribe($email)
493495
$this->sendConfirmationSuccessEmail();
494496
}
495497
return $this->getStatus();
498+
// phpcs:ignore Magento2.Exceptions.ThrowCatch
496499
} catch (\Exception $e) {
500+
// phpcs:ignore Magento2.Exceptions.DirectThrow
497501
throw new \Exception($e->getMessage());
498502
}
499503
}
@@ -559,7 +563,7 @@ public function updateSubscription($customerId)
559563
*
560564
* @param int $customerId
561565
* @param bool $subscribe indicates whether the customer should be subscribed or unsubscribed
562-
* @return $this
566+
* @return $this
563567
*
564568
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
565569
* @SuppressWarnings(PHPMD.NPathComplexity)
@@ -686,7 +690,7 @@ public function confirm($code)
686690
* Mark receiving subscriber of queue newsletter
687691
*
688692
* @param \Magento\Newsletter\Model\Queue $queue
689-
* @return boolean
693+
* @return Subscriber
690694
*/
691695
public function received(\Magento\Newsletter\Model\Queue $queue)
692696
{

0 commit comments

Comments
 (0)