Skip to content

Commit 8b30520

Browse files
committed
Removed direct use of SessionManager class, used SessionManagerInterface instead
1 parent b8892f0 commit 8b30520

File tree

4 files changed

+18
-12
lines changed

4 files changed

+18
-12
lines changed

app/code/Magento/Customer/CustomerData/Plugin/SessionChecker.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66
namespace Magento\Customer\CustomerData\Plugin;
77

8-
use Magento\Framework\Session\SessionManager;
8+
use Magento\Framework\Session\SessionManagerInterface;
99
use Magento\Framework\Stdlib\Cookie\CookieMetadataFactory;
1010
use Magento\Framework\Stdlib\Cookie\PhpCookieManager;
1111

@@ -36,10 +36,10 @@ public function __construct(
3636
/**
3737
* Delete frontend session cookie if customer session is expired
3838
*
39-
* @param SessionManager $sessionManager
39+
* @param SessionManagerInterface $sessionManager
4040
* @return void
4141
*/
42-
public function beforeStart(SessionManager $sessionManager)
42+
public function beforeStart(SessionManagerInterface $sessionManager)
4343
{
4444
if (!$this->cookieManager->getCookie($sessionManager->getName())
4545
&& $this->cookieManager->getCookie('mage-cache-sessid')
@@ -49,4 +49,4 @@ public function beforeStart(SessionManager $sessionManager)
4949
$this->cookieManager->deleteCookie('mage-cache-sessid', $metadata);
5050
}
5151
}
52-
}
52+
}

app/code/Magento/Customer/etc/frontend/di.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
<type name="Magento\Checkout\Block\Cart\Sidebar">
5858
<plugin name="customer_cart" type="Magento\Customer\Model\Cart\ConfigPlugin" />
5959
</type>
60-
<type name="Magento\Framework\Session\SessionManager">
60+
<type name="Magento\Framework\Session\SessionManagerInterface">
6161
<plugin name="session_checker" type="Magento\Customer\CustomerData\Plugin\SessionChecker" />
6262
</type>
6363
<type name="Magento\Authorization\Model\CompositeUserContext">
@@ -77,4 +77,4 @@
7777
</argument>
7878
</arguments>
7979
</type>
80-
</config>
80+
</config>

app/code/Magento/Paypal/Controller/Transparent/RequestSecureToken.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use Magento\Framework\Controller\ResultInterface;
1313
use Magento\Framework\Session\Generic;
1414
use Magento\Framework\Session\SessionManager;
15+
use Magento\Framework\Session\SessionManagerInterface;
1516
use Magento\Paypal\Model\Payflow\Service\Request\SecureToken;
1617
use Magento\Paypal\Model\Payflow\Transparent;
1718
use Magento\Quote\Model\Quote;
@@ -40,7 +41,7 @@ class RequestSecureToken extends \Magento\Framework\App\Action\Action implements
4041
private $secureTokenService;
4142

4243
/**
43-
* @var SessionManager
44+
* @var SessionManager|SessionManagerInterface
4445
*/
4546
private $sessionManager;
4647

@@ -56,19 +57,21 @@ class RequestSecureToken extends \Magento\Framework\App\Action\Action implements
5657
* @param SecureToken $secureTokenService
5758
* @param SessionManager $sessionManager
5859
* @param Transparent $transparent
60+
* @param SessionManagerInterface|null $sessionManagerInterface
5961
*/
6062
public function __construct(
6163
Context $context,
6264
JsonFactory $resultJsonFactory,
6365
Generic $sessionTransparent,
6466
SecureToken $secureTokenService,
6567
SessionManager $sessionManager,
66-
Transparent $transparent
68+
Transparent $transparent,
69+
SessionManagerInterface $sessionInterface = null
6770
) {
6871
$this->resultJsonFactory = $resultJsonFactory;
6972
$this->sessionTransparent = $sessionTransparent;
7073
$this->secureTokenService = $secureTokenService;
71-
$this->sessionManager = $sessionManager;
74+
$this->sessionManager = $sessionInterface ?: $sessionManager;
7275
$this->transparent = $transparent;
7376
parent::__construct($context);
7477
}
@@ -119,4 +122,4 @@ private function getErrorResponse()
119122
]
120123
);
121124
}
122-
}
125+
}

lib/internal/Magento/Framework/View/Context.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Magento\Framework\Event\ManagerInterface;
1515
use Psr\Log\LoggerInterface as Logger;
1616
use Magento\Framework\Session\SessionManager;
17+
use Magento\Framework\Session\SessionManagerInterface;
1718
use Magento\Framework\TranslateInterface;
1819
use Magento\Framework\UrlInterface;
1920
use Magento\Framework\View\ConfigInterface as ViewConfig;
@@ -144,6 +145,7 @@ class Context
144145
* @param Logger $logger
145146
* @param AppState $appState
146147
* @param LayoutInterface $layout
148+
* @param SessionManagerInterface|null $sessionManager
147149
*
148150
* @todo reduce parameter number
149151
*
@@ -163,15 +165,16 @@ public function __construct(
163165
CacheState $cacheState,
164166
Logger $logger,
165167
AppState $appState,
166-
LayoutInterface $layout
168+
LayoutInterface $layout,
169+
SessionManagerInterface $sessionManager = null
167170
) {
168171
$this->request = $request;
169172
$this->eventManager = $eventManager;
170173
$this->urlBuilder = $urlBuilder;
171174
$this->translator = $translator;
172175
$this->cache = $cache;
173176
$this->design = $design;
174-
$this->session = $session;
177+
$this->session = $sessionManager ?: $session;
175178
$this->scopeConfig = $scopeConfig;
176179
$this->frontController = $frontController;
177180
$this->viewConfig = $viewConfig;

0 commit comments

Comments
 (0)