Skip to content

Commit c5bb856

Browse files
committed
Specifically ask for the Json Serializer object and not just relying on the interface that could change
1 parent 6a2e353 commit c5bb856

File tree

5 files changed

+14
-16
lines changed

5 files changed

+14
-16
lines changed

Diff for: app/code/Magento/Captcha/Controller/Adminhtml/Refresh/Refresh.php

+4-6
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
class Refresh extends \Magento\Backend\App\Action
1212
{
1313
/**
14-
* @var \Magento\Framework\Serialize\SerializerInterface
14+
* @var \Magento\Framework\Serialize\Serializer\Json
1515
*/
1616
protected $serializer;
1717

@@ -24,17 +24,15 @@ class Refresh extends \Magento\Backend\App\Action
2424
* Refresh constructor.
2525
* @param \Magento\Backend\App\Action\Context $context
2626
* @param \Magento\Captcha\Helper\Data $captchaHelper
27-
* @param \Magento\Framework\Serialize\SerializerInterface|null $serializer
28-
* @throws \RuntimeException
27+
* @param \Magento\Framework\Serialize\Serializer\Json $serializer
2928
*/
3029
public function __construct(
3130
\Magento\Backend\App\Action\Context $context,
3231
\Magento\Captcha\Helper\Data $captchaHelper,
33-
\Magento\Framework\Serialize\SerializerInterface $serializer = null
32+
\Magento\Framework\Serialize\Serializer\Json $serializer
3433
) {
3534
parent::__construct($context);
36-
$this->serializer = $serializer ?: \Magento\Framework\App\ObjectManager::getInstance()
37-
->get(\Magento\Framework\Serialize\SerializerInterface::class);
35+
$this->serializer = $serializer;
3836
$this->captchaHelper = $captchaHelper;
3937
}
4038

Diff for: app/code/Magento/Captcha/Controller/Refresh/Index.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,24 @@ class Index extends \Magento\Framework\App\Action\Action
1818
protected $captchaHelper;
1919

2020
/**
21-
* @var \Magento\Framework\Serialize\SerializerInterface
21+
* @var \Magento\Framework\Serialize\Serializer\Json
2222
*/
2323
protected $serializer;
2424

2525
/**
2626
* @param Context $context
2727
* @param \Magento\Captcha\Helper\Data $captchaHelper
28-
* @param \Magento\Framework\Serialize\SerializerInterface|null $serializer
28+
* @param \Magento\Framework\Serialize\Serializer\Json|null $serializer
2929
* @throws \RuntimeException
3030
*/
3131
public function __construct(
3232
Context $context,
3333
\Magento\Captcha\Helper\Data $captchaHelper,
34-
\Magento\Framework\Serialize\SerializerInterface $serializer = null
34+
\Magento\Framework\Serialize\Serializer\Json $serializer = null
3535
) {
3636
$this->captchaHelper = $captchaHelper;
3737
$this->serializer = $serializer ?: \Magento\Framework\App\ObjectManager::getInstance()
38-
->get(\Magento\Framework\Serialize\SerializerInterface::class);
38+
->get(\Magento\Framework\Serialize\Serializer\Json::class);
3939
parent::__construct($context);
4040
}
4141

Diff for: app/code/Magento/Captcha/Model/Customer/Plugin/AjaxLogin.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class AjaxLogin
2727
protected $resultJsonFactory;
2828

2929
/**
30-
* @var \Magento\Framework\Serialize\SerializerInterface
30+
* @var \Magento\Framework\Serialize\Serializer\Json
3131
*/
3232
protected $serializer;
3333

@@ -40,22 +40,22 @@ class AjaxLogin
4040
* @param CaptchaHelper $helper
4141
* @param SessionManagerInterface $sessionManager
4242
* @param JsonFactory $resultJsonFactory
43-
* @param \Magento\Framework\Serialize\SerializerInterface|null $serializer
4443
* @param array $formIds
44+
* @param \Magento\Framework\Serialize\Serializer\Json|null $serializer
4545
* @throws \RuntimeException
4646
*/
4747
public function __construct(
4848
CaptchaHelper $helper,
4949
SessionManagerInterface $sessionManager,
5050
JsonFactory $resultJsonFactory,
5151
array $formIds,
52-
\Magento\Framework\Serialize\SerializerInterface $serializer = null
52+
\Magento\Framework\Serialize\Serializer\Json $serializer = null
5353
) {
5454
$this->helper = $helper;
5555
$this->sessionManager = $sessionManager;
5656
$this->resultJsonFactory = $resultJsonFactory;
5757
$this->serializer = $serializer ?: \Magento\Framework\App\ObjectManager::getInstance()
58-
->get(\Magento\Framework\Serialize\SerializerInterface::class);
58+
->get(\Magento\Framework\Serialize\Serializer\Json::class);
5959
$this->formIds = $formIds;
6060
}
6161

Diff for: app/code/Magento/Captcha/Test/Unit/Controller/Refresh/IndexTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ protected function setUp()
6868
$this->layoutMock = $this->getMock(\Magento\Framework\View\LayoutInterface::class);
6969
$this->flagMock = $this->getMock(\Magento\Framework\App\ActionFlag::class, [], [], '', false);
7070
$this->serializerMock = $this->getMock(
71-
\Magento\Framework\Serialize\SerializerInterface::class,
71+
\Magento\Framework\Serialize\Serializer\Json::class,
7272
[],
7373
[],
7474
'',

Diff for: app/code/Magento/Captcha/Test/Unit/Model/Customer/Plugin/AjaxLoginTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ protected function setUp()
8585
->with('user_login')->will($this->returnValue($this->captchaMock));
8686
$this->formIds = ['user_login'];
8787
$this->serializerMock = $this->getMock(
88-
\Magento\Framework\Serialize\SerializerInterface::class,
88+
\Magento\Framework\Serialize\Serializer\Json::class,
8989
[],
9090
[],
9191
'',

0 commit comments

Comments
 (0)