Skip to content

Commit 6e5e27f

Browse files
committed
Refactor array_merge in loop and call_user_func_array
1 parent 7c55ae5 commit 6e5e27f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,13 +133,15 @@ public function process(string $encodedMessage)
133133

134134
$outputData = null;
135135
if ($errorCode === null) {
136+
$handlerMessages = [];
136137
foreach ($handlers as $callback) {
137138
$result = $this->executeHandler($callback, $entityParams);
138139
$status = $result['status'];
139140
$errorCode = $result['error_code'];
140-
$messages = array_merge($messages, $result['messages']);
141+
$handlerMessages[] = $result['messages'];
141142
$outputData = $result['output_data'];
142143
}
144+
$messages = array_merge($messages, ...$handlerMessages);
143145
}
144146

145147
if (isset($outputData)) {
@@ -187,7 +189,7 @@ private function executeHandler($callback, $entityParams)
187189
'output_data' => null
188190
];
189191
try {
190-
$result['output_data'] = call_user_func_array($callback, $entityParams);
192+
$result['output_data'] = $callback(...$entityParams);
191193
$result['messages'][] = sprintf('Service execution success %s::%s', get_class($callback[0]), $callback[1]);
192194
} catch (\Zend_Db_Adapter_Exception $e) {
193195
$this->logger->critical($e->getMessage());

0 commit comments

Comments
 (0)