Skip to content

Commit 1e67549

Browse files
author
Stanislav Idolov
committed
magento/async-import#102: Fixed code style issues
1 parent 3c1de98 commit 1e67549

File tree

5 files changed

+39
-19
lines changed

5 files changed

+39
-19
lines changed

app/code/Magento/AmqpStore/Plugin/AsynchronousOperations/MassConsumerEnvelopeCallback.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,11 @@ public function __construct(
6363
* @return void
6464
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
6565
*/
66-
public function aroundExecute(SubjectMassConsumerEnvelopeCallback $subject, callable $proceed, EnvelopeInterface $message)
67-
{
66+
public function aroundExecute(
67+
SubjectMassConsumerEnvelopeCallback $subject,
68+
callable $proceed,
69+
EnvelopeInterface $message
70+
) {
6871
$amqpProperties = $message->getProperties();
6972
if (isset($amqpProperties['application_headers'])) {
7073
$headers = $amqpProperties['application_headers'];

app/code/Magento/AmqpStore/Plugin/Framework/Amqp/Bulk/Exchange.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ class Exchange
3939
private $logger;
4040

4141
/**
42+
* Exchange constructor.
4243
* @param EnvelopeFactory $envelopeFactory
4344
* @param StoreManagerInterface $storeManager
45+
* @param LoggerInterface $logger
4446
*/
4547
public function __construct(
4648
EnvelopeFactory $envelopeFactory,
@@ -89,6 +91,7 @@ public function beforeEnqueue(SubjectExchange $subject, $topic, array $envelopes
8991
if ($headers instanceof AMQPTable) {
9092
try {
9193
$headers->set('store_id', $storeId);
94+
// phpcs:ignore Magento2.Exceptions.ThrowCatch
9295
} catch (AMQPInvalidArgumentException $ea) {
9396
$errorMessage = sprintf("Can't set storeId to amqp message. Error %s.", $ea->getMessage());
9497
$this->logger->error($errorMessage);

app/code/Magento/AsynchronousOperations/Model/MassConsumer.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,12 @@ public function process($maxNumberOfMessages = null)
8989
*/
9090
private function getTransactionCallback(QueueInterface $queue)
9191
{
92-
$callbackInstance = $this->massConsumerEnvelopeCallback->create([
93-
'configuration' => $this->configuration,
94-
'queue' => $queue,
95-
]);
92+
$callbackInstance = $this->massConsumerEnvelopeCallback->create(
93+
[
94+
'configuration' => $this->configuration,
95+
'queue' => $queue,
96+
]
97+
);
9698
return function (EnvelopeInterface $message) use ($callbackInstance) {
9799
$callbackInstance->execute($message);
98100
};

app/code/Magento/AsynchronousOperations/Model/MassConsumerEnvelopeCallback.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,11 @@ public function __construct(
7474
$this->resource = $resource;
7575
$this->messageController = $messageController;
7676
$this->configuration = $configuration;
77-
$this->operationProcessor = $operationProcessorFactory->create([
78-
'configuration' => $configuration
79-
]);
77+
$this->operationProcessor = $operationProcessorFactory->create(
78+
[
79+
'configuration' => $configuration
80+
]
81+
);
8082
$this->logger = $logger;
8183
$this->queue = $queue;
8284
}
@@ -125,6 +127,7 @@ public function execute(EnvelopeInterface $message)
125127

126128
/**
127129
* Get message queue.
130+
*
128131
* @return QueueInterface
129132
*/
130133
public function getQueue()

dev/tests/api-functional/testsuite/Magento/WebapiAsync/Model/AsyncScheduleMultiStoreTest.php

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,14 @@ protected function setUp()
9999
);
100100

101101
/** @var PublisherConsumerController publisherConsumerController */
102-
$this->publisherConsumerController = $this->objectManager->create(PublisherConsumerController::class, [
103-
'consumers' => $this->consumers,
104-
'logFilePath' => $this->logFilePath,
105-
'appInitParams' => $params,
106-
]);
102+
$this->publisherConsumerController = $this->objectManager->create(
103+
PublisherConsumerController::class,
104+
[
105+
'consumers' => $this->consumers,
106+
'logFilePath' => $this->logFilePath,
107+
'appInitParams' => $params,
108+
]
109+
);
107110
$this->productRepository = $this->objectManager->create(ProductRepositoryInterface::class);
108111

109112
try {
@@ -240,6 +243,7 @@ private function clearProducts()
240243
foreach ($this->skus as $sku) {
241244
$this->productRepository->deleteById($sku);
242245
}
246+
// phpcs:ignore Magento2.Exceptions.ThrowCatch
243247
} catch (\Exception $e) {
244248
throw $e;
245249
//nothing to delete
@@ -252,6 +256,7 @@ private function clearProducts()
252256
->getSize();
253257

254258
if ($size > 0) {
259+
//phpcs:ignore Magento2.Exceptions.DirectThrow
255260
throw new Exception(new Phrase("Collection size after clearing the products: %size", ['size' => $size]));
256261
}
257262
$this->skus = [];
@@ -271,11 +276,13 @@ public function getProductData()
271276

272277
return [
273278
'product' =>
274-
$productBuilder([
275-
ProductInterface::TYPE_ID => 'simple',
276-
ProductInterface::SKU => 'multistore-sku-test-1',
277-
ProductInterface::NAME => 'Test Name ',
278-
]),
279+
$productBuilder(
280+
[
281+
ProductInterface::TYPE_ID => 'simple',
282+
ProductInterface::SKU => 'multistore-sku-test-1',
283+
ProductInterface::NAME => 'Test Name ',
284+
]
285+
),
279286
];
280287
}
281288

@@ -341,10 +348,12 @@ public function assertProductCreation($product)
341348

342349
/**
343350
* Remove test store
351+
* //phpcs:disable
344352
*/
345353
public static function tearDownAfterClass()
346354
{
347355
parent::tearDownAfterClass();
356+
//phpcs:enable
348357
/** @var Registry $registry */
349358
$registry = Bootstrap::getObjectManager()->get(Registry::class);
350359

0 commit comments

Comments
 (0)