Skip to content

Commit 19403b0

Browse files
committed
Replace annoying multi-line warning with short message + context
1 parent c5e00fc commit 19403b0

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

app/code/Magento/Eav/Model/ResourceModel/ReadHandler.php

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,19 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
67
namespace Magento\Eav\Model\ResourceModel;
78

9+
use Exception;
810
use Magento\Eav\Model\Config;
11+
use Magento\Eav\Model\Entity\Attribute\AbstractAttribute;
912
use Magento\Framework\DataObject;
1013
use Magento\Framework\DB\Select;
1114
use Magento\Framework\DB\Sql\UnionExpression;
1215
use Magento\Framework\EntityManager\MetadataPool;
1316
use Magento\Framework\EntityManager\Operation\AttributeInterface;
17+
use Magento\Framework\Exception\ConfigurationMismatchException;
18+
use Magento\Framework\Exception\LocalizedException;
1419
use Magento\Framework\Model\Entity\ScopeInterface;
1520
use Magento\Framework\Model\Entity\ScopeResolver;
1621
use Psr\Log\LoggerInterface;
@@ -63,7 +68,7 @@ public function __construct(
6368
*
6469
* @param string $entityType
6570
* @return \Magento\Eav\Api\Data\AttributeInterface[]
66-
* @throws \Exception if for unknown entity type
71+
* @throws Exception if for unknown entity type
6772
* @deprecated Not used anymore
6873
* @see ReadHandler::getEntityAttributes
6974
*/
@@ -80,7 +85,7 @@ protected function getAttributes($entityType)
8085
* @param string $entityType
8186
* @param DataObject $entity
8287
* @return \Magento\Eav\Api\Data\AttributeInterface[]
83-
* @throws \Exception if for unknown entity type
88+
* @throws Exception if for unknown entity type
8489
*/
8590
private function getEntityAttributes(string $entityType, DataObject $entity): array
8691
{
@@ -111,9 +116,9 @@ protected function getContextVariables(ScopeInterface $scope)
111116
* @param array $entityData
112117
* @param array $arguments
113118
* @return array
114-
* @throws \Exception
115-
* @throws \Magento\Framework\Exception\ConfigurationMismatchException
116-
* @throws \Magento\Framework\Exception\LocalizedException
119+
* @throws Exception
120+
* @throws ConfigurationMismatchException
121+
* @throws LocalizedException
117122
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
118123
*/
119124
public function execute($entityType, $entityData, $arguments = [])
@@ -129,7 +134,7 @@ public function execute($entityType, $entityData, $arguments = [])
129134
$attributesMap = [];
130135
$selects = [];
131136

132-
/** @var \Magento\Eav\Model\Entity\Attribute\AbstractAttribute $attribute */
137+
/** @var AbstractAttribute $attribute */
133138
foreach ($this->getEntityAttributes($entityType, new DataObject($entityData)) as $attribute) {
134139
if (!$attribute->isStatic()) {
135140
$attributeTables[$attribute->getBackend()->getTable()][] = $attribute->getAttributeId();
@@ -170,8 +175,11 @@ public function execute($entityType, $entityData, $arguments = [])
170175
$entityData[$attributesMap[$attributeValue['attribute_id']]] = $attributeValue['value'];
171176
} else {
172177
$this->logger->warning(
173-
"Attempt to load value of nonexistent EAV attribute '{$attributeValue['attribute_id']}'
174-
for entity type '$entityType'."
178+
"Attempt to load value of nonexistent EAV attribute",
179+
[
180+
'attribute_id' => $attributeValue['attribute_id'],
181+
'entity_type' => $entityType
182+
]
175183
);
176184
}
177185
}
@@ -184,8 +192,9 @@ public function execute($entityType, $entityData, $arguments = [])
184192
*
185193
* @param Select[] $selects
186194
* @param array $identifiers
195+
* @return void
187196
*/
188-
private function applyIdentifierForSelects(array $selects, array $identifiers)
197+
private function applyIdentifierForSelects(array $selects, array $identifiers): void
189198
{
190199
foreach ($selects as $select) {
191200
foreach ($identifiers as $identifier) {

0 commit comments

Comments
 (0)