Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 6 additions & 29 deletions app/code/Magento/Store/App/Action/Plugin/Context.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Magento\Framework\App\Action\AbstractAction;
use Magento\Framework\App\Http\Context as HttpContext;
use Magento\Framework\App\RequestInterface;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Framework\Exception\NotFoundException;
use Magento\Framework\Session\SessionManagerInterface;
Expand All @@ -23,42 +24,18 @@
*/
class Context
{
/**
* @var SessionManagerInterface
*/
protected $session;

/**
* @var HttpContext
*/
protected $httpContext;

/**
* @var StoreManagerInterface
*/
protected $storeManager;

/**
* @var StoreCookieManagerInterface
*/
protected $storeCookieManager;

/**
* @param SessionManagerInterface $session
* @param HttpContext $httpContext
* @param StoreManagerInterface $storeManager
* @param StoreCookieManagerInterface $storeCookieManager
*/
public function __construct(
SessionManagerInterface $session,
HttpContext $httpContext,
StoreManagerInterface $storeManager,
StoreCookieManagerInterface $storeCookieManager
protected readonly SessionManagerInterface $session,
protected readonly HttpContext $httpContext,
protected readonly StoreManagerInterface $storeManager,
protected readonly StoreCookieManagerInterface $storeCookieManager
) {
$this->session = $session;
$this->httpContext = $httpContext;
$this->storeManager = $storeManager;
$this->storeCookieManager = $storeCookieManager;
}

/**
Expand Down Expand Up @@ -132,7 +109,7 @@ private function processInvalidStoreRequested(
* @param RequestInterface $request
* @param StoreInterface $store
* @return void
* @throws \Magento\Framework\Exception\LocalizedException
* @throws LocalizedException
*/
private function updateContext(RequestInterface $request, StoreInterface $store)
{
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Store/App/Action/Plugin/StoreCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function __construct(
* @param ActionInterface $subject
* @return void
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
* @throws \Magento\Framework\Exception\State\InitException
* @throws InitException
*/
public function beforeExecute(ActionInterface $subject)
{
Expand Down
33 changes: 5 additions & 28 deletions app/code/Magento/Store/App/Config/Source/InitialConfigSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,46 +8,23 @@
use Magento\Framework\App\Config\ConfigSourceInterface;
use Magento\Framework\App\DeploymentConfig;
use Magento\Framework\App\DeploymentConfig\Reader;
use Magento\Store\Model\Config\Importer;

/**
* Config source. Retrieve all configuration data from files for specified config type
*/
class InitialConfigSource implements ConfigSourceInterface
{
/**
* The file reader
*
* @var Reader
*/
private $reader;

/**
* The deployment config reader
*
* @var DeploymentConfig
*/
private $deploymentConfig;

/**
* The config type
*
* @var string
*/
private $configType;

/**
* @param Reader $reader The file reader
* @param DeploymentConfig $deploymentConfig The deployment config reader
* @param string $configType The config type
*/
public function __construct(
Reader $reader,
DeploymentConfig $deploymentConfig,
$configType
private readonly Reader $reader,
private readonly DeploymentConfig $deploymentConfig,
private $configType
) {
$this->reader = $reader;
$this->deploymentConfig = $deploymentConfig;
$this->configType = $configType;
}

/**
Expand All @@ -64,7 +41,7 @@ public function get($path = '')
/**
* Magento store configuration should not be read from file source if database is available
*
* @see \Magento\Store\Model\Config\Importer To import store configs
* @see Importer To import store configs
*/
if ($this->deploymentConfig->isAvailable() || $this->deploymentConfig->isDbAvailable()) {
return [];
Expand Down
16 changes: 2 additions & 14 deletions app/code/Magento/Store/App/Config/Source/RuntimeConfigSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,6 @@
*/
class RuntimeConfigSource implements ConfigSourceInterface
{
/**
* @var DeploymentConfig
*/
private $deploymentConfig;

/**
* @var ResourceConnection
*/
private $resourceConnection;

/**
* @var AdapterInterface
*/
Expand All @@ -36,11 +26,9 @@ class RuntimeConfigSource implements ConfigSourceInterface
* @param ResourceConnection $resourceConnection
*/
public function __construct(
DeploymentConfig $deploymentConfig,
ResourceConnection $resourceConnection
private readonly DeploymentConfig $deploymentConfig,
private readonly ResourceConnection $resourceConnection
) {
$this->deploymentConfig = $deploymentConfig;
$this->resourceConnection = $resourceConnection;
}

/**
Expand Down
8 changes: 1 addition & 7 deletions app/code/Magento/Store/App/Config/Type/Scopes.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ class Scopes implements ConfigTypeInterface
{
public const CONFIG_TYPE = 'scopes';

/**
* @var ConfigSourceInterface
*/
private $source;

/**
* @var DataObject[]
*/
Expand Down Expand Up @@ -49,9 +44,8 @@ class Scopes implements ConfigTypeInterface
* @param ConfigSourceInterface $source
*/
public function __construct(
ConfigSourceInterface $source
private readonly ConfigSourceInterface $source
) {
$this->source = $source;
}

/**
Expand Down
48 changes: 14 additions & 34 deletions app/code/Magento/Store/App/FrontController/Plugin/DefaultStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,66 +5,46 @@
*/
namespace Magento\Store\App\FrontController\Plugin;

use \Magento\Store\Model\StoreResolver\ReaderList;
use \Magento\Store\Model\ScopeInterface;
use Magento\Framework\App\FrontController;
use Magento\Framework\App\RequestInterface;
use Magento\Store\Model\StoreManagerInterface;
use Magento\Store\Model\StoreResolver\ReaderList;
use Magento\Store\Model\ScopeInterface;

/**
* Plugin to set default store for admin area.
*/
class DefaultStore
{
/**
* @var \Magento\Store\Model\StoreManagerInterface
*/
protected $storeManager;

/**
* @var ReaderList
*/
protected $readerList;

/**
* @var string
*/
protected $runMode;

/**
* @var string
*/
protected $scopeCode;

/**
* Initialize dependencies.
*
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
* @param StoreManagerInterface $storeManager
* @param ReaderList $readerList
* @param string $runMode
* @param null $scopeCode
*/
public function __construct(
\Magento\Store\Model\StoreManagerInterface $storeManager,
ReaderList $readerList,
$runMode = ScopeInterface::SCOPE_STORE,
$scopeCode = null
protected readonly StoreManagerInterface $storeManager,
protected readonly ReaderList $readerList,
protected $runMode = ScopeInterface::SCOPE_STORE,
protected $scopeCode = null
) {
$this->runMode = $scopeCode ? $runMode : ScopeInterface::SCOPE_WEBSITE;
$this->scopeCode = $scopeCode;
$this->readerList = $readerList;
$this->storeManager = $storeManager;
}

/**
* Set current store for admin area
*
* @param \Magento\Framework\App\FrontController $subject
* @param \Magento\Framework\App\RequestInterface $request
* @param FrontController $subject
* @param RequestInterface $request
* @return void
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function beforeDispatch(
\Magento\Framework\App\FrontController $subject,
\Magento\Framework\App\RequestInterface $request
FrontController $subject,
RequestInterface $request
) {
$reader = $this->readerList->getReader($this->runMode);
$defaultStoreId = $reader->getDefaultStoreId($this->scopeCode);
Expand Down
Loading