Skip to content

Commit 7ea830f

Browse files
author
Oleksii Korshenko
authored
Merge pull request magento#1728 from magento-engcom/2.2-develop-prs
Public Pull Requests magento#12257 Phpdoc improvements by @KarlDeux
2 parents 255fecc + 42fd99b commit 7ea830f

File tree

2 files changed

+19
-17
lines changed

2 files changed

+19
-17
lines changed

app/code/Magento/CatalogImportExport/Model/Import/Product.php

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Magento\Catalog\Model\Product\Visibility;
1010
use Magento\CatalogImportExport\Model\Import\Product\RowValidatorInterface as ValidatorInterface;
1111
use Magento\Framework\App\Filesystem\DirectoryList;
12+
use Magento\Framework\Exception\LocalizedException;
1213
use Magento\Framework\Filesystem;
1314
use Magento\Framework\Model\ResourceModel\Db\ObjectRelationProcessor;
1415
use Magento\Framework\Model\ResourceModel\Db\TransactionManagerInterface;
@@ -712,7 +713,7 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity
712713
* @param \Magento\CatalogInventory\Model\Spi\StockStateProviderInterface $stockStateProvider
713714
* @param \Magento\Catalog\Helper\Data $catalogData
714715
* @param \Magento\ImportExport\Model\Import\Config $importConfig
715-
* @param Proxy\Product\ResourceFactory $resourceFactory
716+
* @param Proxy\Product\ResourceModelFactory $resourceFactory
716717
* @param Product\OptionFactory $optionFactory
717718
* @param \Magento\Eav\Model\ResourceModel\Entity\Attribute\Set\CollectionFactory $setColFactory
718719
* @param Product\Type\Factory $productTypeFactory
@@ -1084,12 +1085,12 @@ protected function _initTypeModels()
10841085
$params = [$this, $productTypeName];
10851086
if (!($model = $this->_productTypeFactory->create($productTypeConfig['model'], ['params' => $params]))
10861087
) {
1087-
throw new \Magento\Framework\Exception\LocalizedException(
1088+
throw new LocalizedException(
10881089
__('Entity type model \'%1\' is not found', $productTypeConfig['model'])
10891090
);
10901091
}
10911092
if (!$model instanceof \Magento\CatalogImportExport\Model\Import\Product\Type\AbstractType) {
1092-
throw new \Magento\Framework\Exception\LocalizedException(
1093+
throw new LocalizedException(
10931094
__(
10941095
'Entity type model must be an instance of '
10951096
. \Magento\CatalogImportExport\Model\Import\Product\Type\AbstractType::class
@@ -1551,6 +1552,7 @@ public function getImagesFromRow(array $rowData)
15511552
* @SuppressWarnings(PHPMD.NPathComplexity)
15521553
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
15531554
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
1555+
* @throws LocalizedException
15541556
*/
15551557
protected function _saveProducts()
15561558
{
@@ -1611,7 +1613,7 @@ protected function _saveProducts()
16111613

16121614
// wrong attribute_set_code was received
16131615
if (!$attributeSetId) {
1614-
throw new \Magento\Framework\Exception\LocalizedException(
1616+
throw new LocalizedException(
16151617
__(
16161618
'Wrong attribute set code "%1", please correct it and try again.',
16171619
$rowData['attribute_set_code']
@@ -1998,7 +2000,7 @@ protected function _getUploader()
19982000
}
19992001

20002002
if (!$this->_fileUploader->setTmpDir($tmpPath)) {
2001-
throw new \Magento\Framework\Exception\LocalizedException(
2003+
throw new LocalizedException(
20022004
__('File directory \'%1\' is not readable.', $tmpPath)
20032005
);
20042006
}
@@ -2007,7 +2009,7 @@ protected function _getUploader()
20072009

20082010
$this->_mediaDirectory->create($destinationPath);
20092011
if (!$this->_fileUploader->setDestDir($destinationPath)) {
2010-
throw new \Magento\Framework\Exception\LocalizedException(
2012+
throw new LocalizedException(
20112013
__('File directory \'%1\' is not writable.', $destinationPath)
20122014
);
20132015
}
@@ -2029,6 +2031,7 @@ public function getUploader()
20292031
* Return a new file name if the same file is already exists.
20302032
*
20312033
* @param string $fileName
2034+
* @param bool $renameFileOff
20322035
* @return string
20332036
*/
20342037
protected function uploadMediaFiles($fileName, $renameFileOff = false)
@@ -2753,9 +2756,7 @@ private function _customFieldsMapping($rowData)
27532756
}
27542757

27552758
/**
2756-
* Validate data rows and save bunches to DB
2757-
*
2758-
* @return $this
2759+
* {@inheritdoc}
27592760
*/
27602761
protected function _saveValidatedBunches()
27612762
{

app/code/Magento/ImportExport/Model/Import/Entity/AbstractEntity.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
use Magento\Framework\App\ObjectManager;
99
use Magento\Framework\App\ResourceConnection;
10+
use Magento\Framework\Exception\LocalizedException;
1011
use Magento\Framework\Serialize\Serializer\Json;
1112
use Magento\ImportExport\Model\Import\AbstractSource;
1213
use Magento\ImportExport\Model\Import as ImportExport;
@@ -310,7 +311,7 @@ public function __construct(
310311
protected function _getSource()
311312
{
312313
if (!$this->_source) {
313-
throw new \Magento\Framework\Exception\LocalizedException(__('Please specify a source.'));
314+
throw new LocalizedException(__('Please specify a source.'));
314315
}
315316
return $this->_source;
316317
}
@@ -378,7 +379,7 @@ protected function addErrors($code, $errors)
378379
/**
379380
* Validate data rows and save bunches to DB.
380381
*
381-
* @return $this|void
382+
* @return $this
382383
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
383384
*/
384385
protected function _saveValidatedBunches()
@@ -548,11 +549,11 @@ public function getBehavior()
548549
if (!isset(
549550
$this->_parameters['behavior']
550551
) ||
551-
$this->_parameters['behavior'] != \Magento\ImportExport\Model\Import::BEHAVIOR_APPEND &&
552-
$this->_parameters['behavior'] != \Magento\ImportExport\Model\Import::BEHAVIOR_REPLACE &&
553-
$this->_parameters['behavior'] != \Magento\ImportExport\Model\Import::BEHAVIOR_DELETE
552+
$this->_parameters['behavior'] != ImportExport::BEHAVIOR_APPEND &&
553+
$this->_parameters['behavior'] != ImportExport::BEHAVIOR_REPLACE &&
554+
$this->_parameters['behavior'] != ImportExport::BEHAVIOR_DELETE
554555
) {
555-
return \Magento\ImportExport\Model\Import::getDefaultBehavior();
556+
return ImportExport::getDefaultBehavior();
556557
}
557558
return $this->_parameters['behavior'];
558559
}
@@ -604,7 +605,7 @@ public function getProcessedRowsCount()
604605
public function getSource()
605606
{
606607
if (!$this->_source) {
607-
throw new \Magento\Framework\Exception\LocalizedException(__('The source is not set.'));
608+
throw new LocalizedException(__('The source is not set.'));
608609
}
609610
return $this->_source;
610611
}
@@ -879,7 +880,7 @@ public function getValidColumnNames()
879880
protected function getMetadataPool()
880881
{
881882
if (!$this->metadataPool) {
882-
$this->metadataPool = \Magento\Framework\App\ObjectManager::getInstance()
883+
$this->metadataPool = ObjectManager::getInstance()
883884
->get(\Magento\Framework\EntityManager\MetadataPool::class);
884885
}
885886
return $this->metadataPool;

0 commit comments

Comments
 (0)