Skip to content

Commit e2f577d

Browse files
committed
#20848: Static test fix.
1 parent 347d0d8 commit e2f577d

File tree

5 files changed

+21
-13
lines changed

5 files changed

+21
-13
lines changed

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

Lines changed: 1 addition & 1 deletion
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()

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,17 @@
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
@@ -32,7 +36,7 @@ public function __construct(
3236
$this->subscriberFactory = $subscriberFactory ?: ObjectManager::getInstance()->get(SubscriberFactory::class);
3337
parent::__construct($context, $fileFactory);
3438
}
35-
39+
3640
/**
3741
* Delete one or more subscribers action
3842
*

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
namespace Magento\Newsletter\Controller\Manage;
99

1010
use Magento\Customer\Api\CustomerRepositoryInterface as CustomerRepository;
11-
use Magento\Customer\Model\Customer;
11+
use Magento\Customer\Api\Data\CustomerInterface;
1212
use Magento\Framework\App\Action\HttpGetActionInterface;
1313
use Magento\Framework\App\Action\HttpPostActionInterface;
1414
use Magento\Newsletter\Model\Subscriber;
@@ -68,7 +68,7 @@ public function __construct(
6868
*
6969
* @return \Magento\Framework\App\ResponseInterface
7070
*/
71-
public function execute(): \Magento\Framework\App\ResponseInterface
71+
public function execute()
7272
{
7373
if (!$this->formKeyValidator->validate($this->getRequest())) {
7474
return $this->_redirect('customer/account/');
@@ -117,10 +117,10 @@ public function execute(): \Magento\Framework\App\ResponseInterface
117117
/**
118118
* Set ignore_validation_flag to skip unnecessary address and customer validation
119119
*
120-
* @param Customer $customer
120+
* @param CustomerInterface $customer
121121
* @return void
122122
*/
123-
private function setIgnoreValidationFlag(Customer $customer): void
123+
private function setIgnoreValidationFlag(CustomerInterface $customer): void
124124
{
125125
$customer->setData('ignore_validation_flag', true);
126126
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Confirm extends \Magento\Newsletter\Controller\Subscriber implements HttpG
2020
*
2121
* @return \Magento\Framework\Controller\Result\Redirect
2222
*/
23-
public function execute(): \Magento\Framework\Controller\Result\Redirect
23+
public function execute()
2424
{
2525
$id = (int)$this->getRequest()->getParam('id');
2626
$code = (string)$this->getRequest()->getParam('code');

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

Lines changed: 7 additions & 3 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)

0 commit comments

Comments
 (0)