Skip to content

Commit 86074a0

Browse files
Indrani SonawaneIndrani Sonawane
Indrani Sonawane
authored and
Indrani Sonawane
committed
Merge remote-tracking branch '38951/cleanup-some-non-existing-classes-from-magento-modules' into augcommpr
2 parents 1dd4bb9 + 7b68844 commit 86074a0

File tree

10 files changed

+44
-37
lines changed

10 files changed

+44
-37
lines changed

app/code/Magento/Catalog/Model/ProductRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,7 @@ private function getCollectionProcessor()
813813
{
814814
if (!$this->collectionProcessor) {
815815
$this->collectionProcessor = \Magento\Framework\App\ObjectManager::getInstance()->get(
816-
// phpstan:ignore "Class Magento\Catalog\Model\Api\SearchCriteria\ProductCollectionProcessor not found."
816+
// @phpstan-ignore-next-line - this is a virtual type defined in di.xml
817817
\Magento\Catalog\Model\Api\SearchCriteria\ProductCollectionProcessor::class
818818
);
819819
}

app/code/Magento/CatalogInventory/Model/Indexer/Stock/Action/Full.php

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<?php
22
/**
3-
* @category Magento
4-
* @package Magento_CatalogInventory
53
* Copyright © Magento, Inc. All rights reserved.
64
* See COPYING.txt for license details.
75
*/
@@ -11,25 +9,24 @@
119
namespace Magento\CatalogInventory\Model\Indexer\Stock\Action;
1210

1311
use Magento\Catalog\Api\Data\ProductInterface;
12+
use Magento\Catalog\Model\Product\Type as ProductType;
1413
use Magento\Catalog\Model\ResourceModel\Indexer\ActiveTableSwitcher;
15-
use Magento\CatalogInventory\Model\Indexer\Stock\BatchSizeManagement;
14+
use Magento\CatalogInventory\Model\Indexer\Stock\AbstractAction;
15+
use Magento\CatalogInventory\Model\Indexer\Stock\Processor;
1616
use Magento\CatalogInventory\Model\ResourceModel\Indexer\Stock\DefaultStock;
17-
use Magento\Framework\App\ResourceConnection;
17+
use Magento\CatalogInventory\Model\ResourceModel\Indexer\Stock\StockInterface;
1818
use Magento\CatalogInventory\Model\ResourceModel\Indexer\StockFactory;
19-
use Magento\Catalog\Model\Product\Type as ProductType;
19+
use Magento\Framework\App\DeploymentConfig;
20+
use Magento\Framework\App\ObjectManager;
21+
use Magento\Framework\App\ResourceConnection;
2022
use Magento\Framework\DB\Query\BatchIteratorInterface;
2123
use Magento\Framework\DB\Query\Generator as QueryGenerator;
22-
use Magento\Framework\Indexer\CacheContext;
23-
use Magento\Framework\Event\ManagerInterface as EventManager;
2424
use Magento\Framework\EntityManager\MetadataPool;
25-
use Magento\Framework\Indexer\BatchSizeManagementInterface;
26-
use Magento\Framework\Indexer\BatchProviderInterface;
27-
use Magento\Framework\App\ObjectManager;
25+
use Magento\Framework\Event\ManagerInterface as EventManager;
2826
use Magento\Framework\Exception\LocalizedException;
29-
use Magento\CatalogInventory\Model\Indexer\Stock\AbstractAction;
30-
use Magento\CatalogInventory\Model\ResourceModel\Indexer\Stock\StockInterface;
31-
use Magento\Framework\App\DeploymentConfig;
32-
use Magento\CatalogInventory\Model\Indexer\Stock\Processor;
27+
use Magento\Framework\Indexer\BatchProviderInterface;
28+
use Magento\Framework\Indexer\BatchSizeManagementInterface;
29+
use Magento\Framework\Indexer\CacheContext;
3330

3431
/**
3532
* Class Full reindex action
@@ -41,7 +38,7 @@ class Full extends AbstractAction
4138
/**
4239
* Action type representation
4340
*/
44-
const ACTION_TYPE = 'full';
41+
public const ACTION_TYPE = 'full';
4542

4643
/**
4744
* @var MetadataPool
@@ -125,7 +122,7 @@ public function __construct(
125122
$this->metadataPool = $metadataPool ?: ObjectManager::getInstance()->get(MetadataPool::class);
126123
$this->batchProvider = $batchProvider ?: ObjectManager::getInstance()->get(BatchProviderInterface::class);
127124
$this->batchSizeManagement = $batchSizeManagement ?: ObjectManager::getInstance()->get(
128-
BatchSizeManagement::class
125+
BatchSizeManagementInterface::class
129126
);
130127
$this->batchRowsCount = $batchRowsCount;
131128
$this->activeTableSwitcher = $activeTableSwitcher ?: ObjectManager::getInstance()
@@ -151,6 +148,7 @@ public function execute($ids = null): void
151148
$entityMetadata = $this->metadataPool->getMetadata(ProductInterface::class);
152149

153150
$columns = array_keys($this->_getConnection()->describeTable($this->_getIdxTable()));
151+
$indexerTables = [];
154152

155153
/** @var DefaultStock $indexer */
156154
foreach ($this->_getTypeIndexers() as $indexer) {
@@ -165,7 +163,7 @@ public function execute($ids = null): void
165163
)
166164
);
167165

168-
if (is_null($batchRowCount)) {
166+
if ($batchRowCount === null) {
169167
$batchRowCount = isset($this->batchRowsCount[$indexer->getTypeId()])
170168
? $this->batchRowsCount[$indexer->getTypeId()]
171169
: $this->batchRowsCount['default'];
@@ -202,8 +200,12 @@ public function execute($ids = null): void
202200
$connection->query($query);
203201
}
204202
}
203+
204+
$indexerTables[] = $indexer->getMainTable();
205205
}
206-
$this->activeTableSwitcher->switchTable($indexer->getConnection(), [$indexer->getMainTable()]);
206+
207+
$indexerTables = array_unique($indexerTables);
208+
$this->activeTableSwitcher->switchTable($this->_getConnection(), $indexerTables);
207209
} catch (\Exception $e) {
208210
throw new LocalizedException(__($e->getMessage()), $e);
209211
}

app/code/Magento/CatalogRule/Model/ResourceModel/Rule.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,10 @@ public function __construct(
129129
$this->priceCurrency = $priceCurrency;
130130
$this->entityManager = $entityManager ?? ObjectManager::getInstance()->get(EntityManager::class);
131131
$this->_associatedEntitiesMap = $associatedEntityMap ?? ObjectManager::getInstance()
132-
// phpstan:ignore this is a virtual class
132+
// @phpstan-ignore-next-line - this is a virtual type defined in di.xml
133133
->get(\Magento\CatalogRule\Model\ResourceModel\Rule\AssociatedEntityMap::class)
134134
->getData();
135+
135136
parent::__construct($context, $connectionName);
136137
}
137138

@@ -216,12 +217,8 @@ public function getRulesFromProduct($date, $websiteId, $customerGroupId, $produc
216217
}
217218

218219
/**
219-
* Load an object
220+
* @inheritDoc
220221
*
221-
* @param \Magento\Framework\Model\AbstractModel $object
222-
* @param mixed $value
223-
* @param string $field
224-
* @return $this
225222
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
226223
*/
227224
public function load(\Magento\Framework\Model\AbstractModel $object, $value, $field = null)

app/code/Magento/CatalogRule/Model/ResourceModel/Rule/Collection.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,13 @@ public function addCustomerGroupFilter($customerGroupId)
159159
*
160160
* @return array
161161
* @deprecated 100.1.0
162+
* @see https://github.com/magento/magento2/commit/d063251cf0ce6717795fdb646a534cc0c2b22c05
162163
*/
163164
private function getAssociatedEntitiesMap()
164165
{
165166
if (!$this->_associatedEntitiesMap) {
166167
$this->_associatedEntitiesMap = \Magento\Framework\App\ObjectManager::getInstance()
167-
// phpstan:ignore
168+
// @phpstan-ignore-next-line - this is a virtual type defined in di.xml
168169
->get(\Magento\CatalogRule\Model\ResourceModel\Rule\AssociatedEntityMap::class)
169170
->getData();
170171
}

app/code/Magento/Cms/Model/PageRepository.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,13 +285,13 @@ public function deleteById($pageId)
285285
*
286286
* @deprecated 102.0.0
287287
* @return CollectionProcessorInterface
288+
* @see https://github.com/magento/magento2/commit/eacac63d35b97961e3304dc007cd6b78519a93d0
288289
*/
289290
private function getCollectionProcessor()
290291
{
291292
if (!$this->collectionProcessor) {
292-
// phpstan:ignore "Class Magento\Cms\Model\Api\SearchCriteria\PageCollectionProcessor not found."
293-
$this->collectionProcessor = ObjectManager::getInstance()
294-
->get(PageCollectionProcessor::class);
293+
// @phpstan-ignore-next-line - this is a virtual type defined in di.xml
294+
$this->collectionProcessor = ObjectManager::getInstance()->get(PageCollectionProcessor::class);
295295
}
296296
return $this->collectionProcessor;
297297
}

app/code/Magento/Paypal/Observer/AddPaypalShortcutsObserver.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,13 @@ public function execute(EventObserver $observer)
5757
SmartButton::class => PaypalConfig::METHOD_WPS_EXPRESS,
5858
\Magento\Paypal\Block\Express\Shortcut::class => PaypalConfig::METHOD_WPP_EXPRESS,
5959
\Magento\Paypal\Block\Bml\Shortcut::class => PaypalConfig::METHOD_WPP_EXPRESS,
60+
// @phpstan-ignore-next-line - this is a virtual type defined in di.xml
6061
\Magento\Paypal\Block\WpsExpress\Shortcut::class => PaypalConfig::METHOD_WPS_EXPRESS,
62+
// @phpstan-ignore-next-line - this is a virtual type defined in di.xml
6163
\Magento\Paypal\Block\WpsBml\Shortcut::class => PaypalConfig::METHOD_WPS_EXPRESS,
64+
// @phpstan-ignore-next-line - this is a virtual type defined in di.xml
6265
\Magento\Paypal\Block\PayflowExpress\Shortcut::class => PaypalConfig::METHOD_WPP_PE_EXPRESS,
66+
// @phpstan-ignore-next-line - this is a virtual type defined in di.xml
6367
\Magento\Paypal\Block\Payflow\Bml\Shortcut::class => PaypalConfig::METHOD_WPP_PE_EXPRESS
6468
];
6569
foreach ($blocks as $blockInstanceName => $paymentMethodCode) {

app/code/Magento/Sales/Controller/Adminhtml/Creditmemo/AbstractCreditmemo/PrintAction.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,19 @@
55
*/
66
namespace Magento\Sales\Controller\Adminhtml\Creditmemo\AbstractCreditmemo;
77

8-
use Magento\Framework\App\ResponseInterface;
8+
use Magento\Framework\App\Action\HttpGetActionInterface;
99
use Magento\Framework\App\Filesystem\DirectoryList;
10+
use Magento\Framework\App\ResponseInterface;
1011
use Magento\Sales\Api\CreditmemoRepositoryInterface;
1112

12-
class PrintAction extends \Magento\Backend\App\Action
13+
class PrintAction extends \Magento\Backend\App\Action implements HttpGetActionInterface
1314
{
1415
/**
1516
* Authorization level of a basic admin session
1617
*
1718
* @see _isAllowed()
1819
*/
19-
const ADMIN_RESOURCE = 'Magento_Sales::sales_creditmemo';
20+
public const ADMIN_RESOURCE = 'Magento_Sales::sales_creditmemo';
2021

2122
/**
2223
* @var \Magento\Framework\App\Response\Http\FileFactory
@@ -52,6 +53,8 @@ public function __construct(
5253
}
5354

5455
/**
56+
* Execute action based on request and return result
57+
*
5558
* @return ResponseInterface|\Magento\Backend\Model\View\Result\Forward
5659
* @throws \Exception
5760
*/
@@ -73,7 +76,7 @@ public function execute()
7376
$fileContent = ['type' => 'string', 'value' => $pdf->render(), 'rm' => true];
7477

7578
return $this->_fileFactory->create(
76-
\creditmemo::class . $date . '.pdf',
79+
'creditmemo' . $date . '.pdf',
7780
$fileContent,
7881
DirectoryList::VAR_DIR,
7982
'application/pdf'

app/code/Magento/Sales/Test/Unit/Helper/ReorderTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class ReorderTest extends TestCase
3131
protected $scopeConfigMock;
3232

3333
/**
34-
* @var MockObject|\Magento\Sales\Model\Store
34+
* @var MockObject|\Magento\Store\Model\Store
3535
*/
3636
protected $storeParam;
3737

@@ -78,7 +78,7 @@ protected function setUp(): void
7878
$this->repositoryMock
7979
);
8080

81-
$this->storeParam = $this->getMockBuilder(\Magento\Sales\Model\Store::class)
81+
$this->storeParam = $this->getMockBuilder(\Magento\Store\Model\Store::class)
8282
->disableOriginalConstructor()
8383
->getMock();
8484

app/code/Magento/SalesRule/Model/ResourceModel/Rule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public function __construct(
8484
$this->string = $string;
8585
$this->_resourceCoupon = $resourceCoupon;
8686
$associatedEntitiesMapInstance = $associatedEntityMapInstance ?: ObjectManager::getInstance()->get(
87-
// phpstan:ignore "Class Magento\SalesRule\Model\ResourceModel\Rule\AssociatedEntityMap not found."
87+
// @phpstan-ignore-next-line - this is a virtual type defined in di.xml
8888
\Magento\SalesRule\Model\ResourceModel\Rule\AssociatedEntityMap::class
8989
);
9090
$this->_associatedEntitiesMap = $associatedEntitiesMapInstance->getData();

app/code/Magento/SalesRule/Model/ResourceModel/Rule/Collection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ private function getAssociatedEntitiesMap()
463463
{
464464
if (!$this->_associatedEntitiesMap) {
465465
$this->_associatedEntitiesMap = \Magento\Framework\App\ObjectManager::getInstance()
466-
// phpstan:ignore "Class Magento\SalesRule\Model\ResourceModel\Rule\AssociatedEntityMap not found."
466+
// @phpstan-ignore-next-line - this is a virtual type defined in di.xml
467467
->get(\Magento\SalesRule\Model\ResourceModel\Rule\AssociatedEntityMap::class)
468468
->getData();
469469
}

0 commit comments

Comments
 (0)