diff --git a/app/code/Magento/Bundle/Model/Product/Type.php b/app/code/Magento/Bundle/Model/Product/Type.php index a2a02cbd715..d25f856e0b4 100644 --- a/app/code/Magento/Bundle/Model/Product/Type.php +++ b/app/code/Magento/Bundle/Model/Product/Type.php @@ -6,13 +6,13 @@ namespace Magento\Bundle\Model\Product; -use Magento\Framework\App\ObjectManager; +use Magento\Bundle\Model\ResourceModel\Selection\Collection as Selections; +use Magento\Bundle\Model\ResourceModel\Selection\Collection\FilterApplier as SelectionCollectionFilterApplier; use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Framework\App\ObjectManager; +use Magento\Framework\EntityManager\MetadataPool; use Magento\Framework\Pricing\PriceCurrencyInterface; use Magento\Framework\Serialize\Serializer\Json; -use Magento\Framework\EntityManager\MetadataPool; -use Magento\Bundle\Model\ResourceModel\Selection\Collection\FilterApplier as SelectionCollectionFilterApplier; -use Magento\Bundle\Model\ResourceModel\Selection\Collection as Selections; /** * Bundle Type Model @@ -537,7 +537,7 @@ public function updateQtyOption($options, \Magento\Framework\DataObject $option, foreach ($options as $quoteItemOption) { if ($quoteItemOption->getCode() == 'selection_qty_' . $selection->getSelectionId()) { if ($optionUpdateFlag) { - $quoteItemOption->setValue(intval($quoteItemOption->getValue())); + $quoteItemOption->setValue((int) $quoteItemOption->getValue()); } else { $quoteItemOption->setValue($value); } @@ -625,6 +625,7 @@ public function isSalable($product) /** * Prepare product and its configuration to be added to some products list. + * * Perform standard preparation process and then prepare of bundle selections options. * * @param \Magento\Framework\DataObject $buyRequest @@ -790,6 +791,8 @@ protected function _prepareProduct(\Magento\Framework\DataObject $buyRequest, $p } /** + * Cast array values to int + * * @param array $array * @return int[]|int[][] */ @@ -809,6 +812,8 @@ private function recursiveIntval(array $array) } /** + * Convert multi dimensional array to flat + * * @param array $array * @return int[] */ @@ -920,8 +925,7 @@ public function getOptionsByIds($optionIds, $product) } /** - * Prepare additional options/information for order item which will be - * created from this product + * Prepare additional options/information for order item which will be created from this product * * @param \Magento\Catalog\Model\Product $product * @return array @@ -987,6 +991,7 @@ public function getOrderOptions($product) /** * Sort selections method for usort function + * * Sort selections by option position, selection position and selection id * * @param \Magento\Catalog\Model\Product $firstItem @@ -1050,6 +1055,7 @@ public function getForceChildItemQtyChanges($product) /** * Retrieve additional searchable data from type instance + * * Using based on product id and store_id data * * @param \Magento\Catalog\Model\Product $product @@ -1118,6 +1124,7 @@ public function checkProductBuyState($product) /** * Retrieve products divided into groups required to purchase + * * At least one product in each group has to be purchased * * @param \Magento\Catalog\Model\Product $product @@ -1214,6 +1221,8 @@ public function getIdentities(\Magento\Catalog\Model\Product $product) } /** + * Returns selection qty + * * @param \Magento\Framework\DataObject $selection * @param int[] $qtys * @param int $selectionOptionId @@ -1232,6 +1241,8 @@ protected function getQty($selection, $qtys, $selectionOptionId) } /** + * Returns qty + * * @param \Magento\Catalog\Model\Product $product * @param \Magento\Framework\DataObject $selection * @return float|int @@ -1249,6 +1260,8 @@ protected function getBeforeQty($product, $selection) } /** + * Validate required options + * * @param \Magento\Catalog\Model\Product $product * @param bool $isStrictProcessMode * @param \Magento\Bundle\Model\ResourceModel\Option\Collection $optionsCollection @@ -1270,6 +1283,8 @@ protected function checkIsAllRequiredOptions($product, $isStrictProcessMode, $op } /** + * Check if selection is salable + * * @param \Magento\Bundle\Model\ResourceModel\Selection\Collection $selections * @param bool $skipSaleableCheck * @param \Magento\Bundle\Model\ResourceModel\Option\Collection $optionsCollection @@ -1300,6 +1315,8 @@ protected function checkSelectionsIsSale($selections, $skipSaleableCheck, $optio } /** + * Validate result + * * @param array $_result * @return void * @throws \Magento\Framework\Exception\LocalizedException @@ -1318,6 +1335,8 @@ protected function checkIsResult($_result) } /** + * Merge selections with options + * * @param \Magento\Catalog\Model\Product\Option[] $options * @param \Magento\Framework\DataObject[] $selections * @return \Magento\Framework\DataObject[] diff --git a/app/code/Magento/Catalog/Block/Product/Widget/NewWidget.php b/app/code/Magento/Catalog/Block/Product/Widget/NewWidget.php index 704271b58f4..b4c24231a74 100644 --- a/app/code/Magento/Catalog/Block/Product/Widget/NewWidget.php +++ b/app/code/Magento/Catalog/Block/Product/Widget/NewWidget.php @@ -139,7 +139,7 @@ public function getCacheKeyInfo() [ $this->getDisplayType(), $this->getProductsPerPage(), - intval($this->getRequest()->getParam($this->getData('page_var_name'), 1)), + (int) $this->getRequest()->getParam($this->getData('page_var_name'), 1), $this->serializer->serialize($this->getRequest()->getParams()) ] ); diff --git a/app/code/Magento/Catalog/Model/Category.php b/app/code/Magento/Catalog/Model/Category.php index cf79ff01d31..999f08aa1ea 100644 --- a/app/code/Magento/Catalog/Model/Category.php +++ b/app/code/Magento/Catalog/Model/Category.php @@ -300,7 +300,7 @@ protected function _construct() } /** - * {@inheritdoc} + * @inheritdoc */ protected function getCustomAttributesCodes() { @@ -312,6 +312,8 @@ protected function getCustomAttributesCodes() } /** + * Returns model resource + * * @throws \Magento\Framework\Exception\LocalizedException * @return \Magento\Catalog\Model\ResourceModel\Category * @deprecated because resource models should be used directly @@ -648,6 +650,8 @@ public function formatUrlKey($str) } /** + * Returns image url + * * @param string $attributeCode * @return bool|string * @throws \Magento\Framework\Exception\LocalizedException @@ -708,7 +712,7 @@ public function getParentId() return $parentId; } $parentIds = $this->getParentIds(); - return intval(array_pop($parentIds)); + return (int) array_pop($parentIds); } /** @@ -796,6 +800,7 @@ public function getChildren($recursive = false, $isActive = true, $sortByPositio /** * Retrieve Stores where isset category Path + * * Return comma separated string * * @return string @@ -826,6 +831,7 @@ public function checkId($id) /** * Get array categories ids which are part of category path + * * Result array contain id of current category because it is part of the path * * @return array @@ -1029,7 +1035,8 @@ public function getAvailableSortBy() /** * Retrieve Available Product Listing Sort By - * code as key, value - name + * + * Code as key, value - name * * @return array */ @@ -1150,6 +1157,8 @@ public function getIdentities() } /** + * Returns path + * * @codeCoverageIgnoreStart * @return string|null */ @@ -1159,6 +1168,8 @@ public function getPath() } /** + * Returns position + * * @return int|null */ public function getPosition() @@ -1167,6 +1178,8 @@ public function getPosition() } /** + * Returns children count + * * @return int */ public function getChildrenCount() @@ -1175,6 +1188,8 @@ public function getChildrenCount() } /** + * Returns created at + * * @return string|null */ public function getCreatedAt() @@ -1183,6 +1198,8 @@ public function getCreatedAt() } /** + * Returns updated at + * * @return string|null */ public function getUpdatedAt() @@ -1191,6 +1208,8 @@ public function getUpdatedAt() } /** + * Returns is active + * * @return bool * @SuppressWarnings(PHPMD.BooleanGetMethodName) */ @@ -1200,6 +1219,8 @@ public function getIsActive() } /** + * Returns category id + * * @return int|null */ public function getCategoryId() @@ -1208,6 +1229,8 @@ public function getCategoryId() } /** + * Returns display mode + * * @return string|null */ public function getDisplayMode() @@ -1216,6 +1239,8 @@ public function getDisplayMode() } /** + * Returns is include in menu + * * @return bool|null */ public function getIncludeInMenu() @@ -1224,6 +1249,8 @@ public function getIncludeInMenu() } /** + * Returns url key + * * @return string|null */ public function getUrlKey() @@ -1232,6 +1259,8 @@ public function getUrlKey() } /** + * Returns children data + * * @return \Magento\Catalog\Api\Data\CategoryTreeInterface[]|null */ public function getChildrenData() @@ -1347,6 +1376,8 @@ public function setLevel($level) } /** + * Set updated at + * * @param string $updatedAt * @return $this */ @@ -1356,6 +1387,8 @@ public function setUpdatedAt($updatedAt) } /** + * Set created at + * * @param string $createdAt * @return $this */ @@ -1365,6 +1398,8 @@ public function setCreatedAt($createdAt) } /** + * Set path + * * @param string $path * @return $this */ @@ -1374,6 +1409,8 @@ public function setPath($path) } /** + * Set available sort by + * * @param string[]|string $availableSortBy * @return $this */ @@ -1383,6 +1420,8 @@ public function setAvailableSortBy($availableSortBy) } /** + * Set include in menu + * * @param bool $includeInMenu * @return $this */ @@ -1403,6 +1442,8 @@ public function setProductCount($productCount) } /** + * Set children data + * * @param \Magento\Catalog\Api\Data\CategoryTreeInterface[] $childrenData * @return $this */ @@ -1412,7 +1453,7 @@ public function setChildrenData(array $childrenData = null) } /** - * {@inheritdoc} + * @inheritdoc * * @return \Magento\Catalog\Api\Data\CategoryExtensionInterface|null */ @@ -1422,7 +1463,7 @@ public function getExtensionAttributes() } /** - * {@inheritdoc} + * @inheritdoc * * @param \Magento\Catalog\Api\Data\CategoryExtensionInterface $extensionAttributes * @return $this diff --git a/app/code/Magento/Catalog/Model/ImageExtractor.php b/app/code/Magento/Catalog/Model/ImageExtractor.php index 1c206086706..dcc70cbcd2a 100644 --- a/app/code/Magento/Catalog/Model/ImageExtractor.php +++ b/app/code/Magento/Catalog/Model/ImageExtractor.php @@ -9,6 +9,9 @@ use Magento\Catalog\Model\Product\Attribute\Backend\Media\ImageEntryConverter; use Magento\Framework\View\Xsd\Media\TypeDataExtractorInterface; +/** + * Image extractor from xml configuration + */ class ImageExtractor implements TypeDataExtractorInterface { /** @@ -36,7 +39,7 @@ public function process(\DOMElement $mediaNode, $mediaParentTag) if ($attributeTagName === 'background') { $nodeValue = $this->processImageBackground($attribute->nodeValue); } elseif ($attributeTagName === 'width' || $attributeTagName === 'height') { - $nodeValue = intval($attribute->nodeValue); + $nodeValue = (int) $attribute->nodeValue; } else { $nodeValue = $attribute->nodeValue; } diff --git a/app/code/Magento/Catalog/Model/Product/Compare/Item.php b/app/code/Magento/Catalog/Model/Product/Compare/Item.php index 3b7e47a46a0..fd07380bebd 100644 --- a/app/code/Magento/Catalog/Model/Product/Compare/Item.php +++ b/app/code/Magento/Catalog/Model/Product/Compare/Item.php @@ -158,8 +158,8 @@ public function addProductData($product) { if ($product instanceof Product) { $this->setProductId($product->getId()); - } elseif (intval($product)) { - $this->setProductId(intval($product)); + } elseif ((int) $product) { + $this->setProductId((int) $product); } return $this; diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/Date.php b/app/code/Magento/Catalog/Model/Product/Option/Type/Date.php index 7517459da65..b19906ecd6c 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/Date.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/Date.php @@ -102,11 +102,11 @@ public function validateUserValue($values) $this->setUserValue( [ 'date' => isset($value['date']) ? $value['date'] : '', - 'year' => isset($value['year']) ? intval($value['year']) : 0, - 'month' => isset($value['month']) ? intval($value['month']) : 0, - 'day' => isset($value['day']) ? intval($value['day']) : 0, - 'hour' => isset($value['hour']) ? intval($value['hour']) : 0, - 'minute' => isset($value['minute']) ? intval($value['minute']) : 0, + 'year' => isset($value['year']) ? (int) $value['year'] : 0, + 'month' => isset($value['month']) ? (int) $value['month'] : 0, + 'day' => isset($value['day']) ? (int) $value['day'] : 0, + 'hour' => isset($value['hour']) ? (int) $value['hour'] : 0, + 'minute' => isset($value['minute']) ? (int) $value['minute'] : 0, 'day_part' => isset($value['day_part']) ? $value['day_part'] : '', 'date_internal' => isset($value['date_internal']) ? $value['date_internal'] : '', ] diff --git a/app/code/Magento/Catalog/Model/Product/Option/Validator/DefaultValidator.php b/app/code/Magento/Catalog/Model/Product/Option/Validator/DefaultValidator.php index ee508e30cc9..99d5016f5cd 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Validator/DefaultValidator.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Validator/DefaultValidator.php @@ -9,6 +9,9 @@ use Magento\Catalog\Model\Product\Option; use Zend_Validate_Exception; +/** + * Product option default validator + */ class DefaultValidator extends \Magento\Framework\Validator\AbstractValidator { /** @@ -168,6 +171,6 @@ protected function isInRange($value, array $range) */ protected function isNegative($value) { - return intval($value) < 0; + return (int) $value < 0; } } diff --git a/app/code/Magento/Catalog/Model/Product/PriceModifier.php b/app/code/Magento/Catalog/Model/Product/PriceModifier.php index 48d53b46145..c4d5bdfedcd 100644 --- a/app/code/Magento/Catalog/Model/Product/PriceModifier.php +++ b/app/code/Magento/Catalog/Model/Product/PriceModifier.php @@ -9,6 +9,9 @@ use Magento\Framework\Exception\CouldNotSaveException; use Magento\Framework\Exception\NoSuchEntityException; +/** + * Product form price modifier + */ class PriceModifier { /** @@ -26,6 +29,8 @@ public function __construct( } /** + * Remove tier price + * * @param \Magento\Catalog\Model\Product $product * @param int|string $customerGroupId * @param int $qty @@ -46,11 +51,11 @@ public function removeTierPrice(\Magento\Catalog\Model\Product $product, $custom foreach ($prices as $key => $tierPrice) { if ($customerGroupId == 'all' && $tierPrice['price_qty'] == $qty - && $tierPrice['all_groups'] == 1 && intval($tierPrice['website_id']) === intval($websiteId) + && $tierPrice['all_groups'] == 1 && (int) $tierPrice['website_id'] === (int) $websiteId ) { unset($prices[$key]); } elseif ($tierPrice['price_qty'] == $qty && $tierPrice['cust_group'] == $customerGroupId - && intval($tierPrice['website_id']) === intval($websiteId) + && (int) $tierPrice['website_id'] === (int) $websiteId ) { unset($prices[$key]); } diff --git a/app/code/Magento/Catalog/Model/Product/TierPriceManagement.php b/app/code/Magento/Catalog/Model/Product/TierPriceManagement.php index 822959bfc85..f2da1e77027 100644 --- a/app/code/Magento/Catalog/Model/Product/TierPriceManagement.php +++ b/app/code/Magento/Catalog/Model/Product/TierPriceManagement.php @@ -15,6 +15,8 @@ use Magento\Framework\Exception\TemporaryStateExceptionInterface; /** + * Product tier price management + * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class TierPriceManagement implements \Magento\Catalog\Api\ProductTierPriceManagementInterface @@ -82,7 +84,7 @@ public function __construct( } /** - * {@inheritdoc} + * @inheritdoc * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) */ @@ -148,7 +150,7 @@ public function add($sku, $customerGroupId, $price, $qty) } /** - * {@inheritdoc} + * @inheritdoc */ public function remove($sku, $customerGroupId, $qty) { @@ -163,7 +165,7 @@ public function remove($sku, $customerGroupId, $qty) } /** - * {@inheritdoc} + * @inheritdoc */ public function getList($sku, $customerGroupId) { @@ -181,7 +183,7 @@ public function getList($sku, $customerGroupId) $prices = []; foreach ($product->getData('tier_price') as $price) { - if ((is_numeric($customerGroupId) && intval($price['cust_group']) === intval($customerGroupId)) + if ((is_numeric($customerGroupId) && (int) $price['cust_group'] === (int) $customerGroupId) || ($customerGroupId === 'all' && $price['all_groups']) ) { /** @var \Magento\Catalog\Api\Data\ProductTierPriceInterface $tierPrice */ diff --git a/app/code/Magento/Catalog/Model/Product/Type.php b/app/code/Magento/Catalog/Model/Product/Type.php index 7be199884be..4c973be20de 100644 --- a/app/code/Magento/Catalog/Model/Product/Type.php +++ b/app/code/Magento/Catalog/Model/Product/Type.php @@ -285,7 +285,7 @@ public function getTypesByPriority() $types = $this->getTypes(); foreach ($types as $typeId => $typeInfo) { - $priority = isset($typeInfo['index_priority']) ? abs(intval($typeInfo['index_priority'])) : 0; + $priority = isset($typeInfo['index_priority']) ? abs((int) $typeInfo['index_priority']) : 0; if (!empty($typeInfo['composite'])) { $compositePriority[$typeId] = $priority; } else { @@ -307,7 +307,7 @@ public function getTypesByPriority() } /** - * {@inheritdoc} + * @inheritdoc */ public function toOptionArray() { diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Category.php b/app/code/Magento/Catalog/Model/ResourceModel/Category.php index 9de0e8a8490..1523809d9cc 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Category.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Category.php @@ -16,6 +16,8 @@ use Magento\Framework\EntityManager\EntityManager; /** + * Resource model for category entity + * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class Category extends AbstractResource @@ -249,7 +251,8 @@ public function deleteChildren(\Magento\Framework\DataObject $object) /** * Process category data before saving - * prepare path and increment children count for parent categories + * + * Prepare path and increment children count for parent categories * * @param \Magento\Framework\DataObject $object * @return $this @@ -298,7 +301,8 @@ protected function _beforeSave(\Magento\Framework\DataObject $object) /** * Process category data after save category object - * save related products ids and update path value + * + * Save related products ids and update path value * * @param \Magento\Framework\DataObject $object * @return $this @@ -664,7 +668,7 @@ public function getProductCount($category) $bind = ['category_id' => (int)$category->getId()]; $counts = $this->getConnection()->fetchOne($select, $bind); - return intval($counts); + return (int) $counts; } /** @@ -862,6 +866,7 @@ public function isInRootCategoryList($category) /** * Check category is forbidden to delete. + * * If category is root and assigned to store group return false * * @param integer $categoryId @@ -982,6 +987,7 @@ public function changeParent( /** * Process positions of old parent category children and new parent category children. + * * Get position for moved category * * @param \Magento\Catalog\Model\Category $category @@ -1062,7 +1068,7 @@ public function load($object, $entityId, $attributes = []) } /** - * {@inheritdoc} + * @inheritdoc */ public function delete($object) { @@ -1088,6 +1094,8 @@ public function save(\Magento\Framework\Model\AbstractModel $object) } /** + * Returns EntityManager object + * * @return EntityManager */ private function getEntityManager() @@ -1100,6 +1108,8 @@ private function getEntityManager() } /** + * Returns AggregateCount object + * * @return Category\AggregateCount */ private function getAggregateCount() diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Category/Flat.php b/app/code/Magento/Catalog/Model/ResourceModel/Category/Flat.php index 01e4b072b03..9db2c8248ce 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Category/Flat.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Category/Flat.php @@ -173,7 +173,7 @@ public function getMainTable() public function getMainStoreTable($storeId = \Magento\Store\Model\Store::DEFAULT_STORE_ID) { if (is_string($storeId)) { - $storeId = intval($storeId); + $storeId = (int) $storeId; } if ($storeId) { diff --git a/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/Initializer/Option.php b/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/Initializer/Option.php index 6595aec78f5..a48b9ae5f08 100644 --- a/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/Initializer/Option.php +++ b/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/Initializer/Option.php @@ -120,7 +120,7 @@ public function initialize( /** * if option's qty was updates we also need to update quote item qty */ - $quoteItem->setData('qty', intval($qty)); + $quoteItem->setData('qty', (int) $qty); } if ($result->getMessage() !== null) { $option->setMessage($result->getMessage()); diff --git a/app/code/Magento/CatalogInventory/Model/StockStateProvider.php b/app/code/Magento/CatalogInventory/Model/StockStateProvider.php index fb6fc3be613..31fd5606a98 100644 --- a/app/code/Magento/CatalogInventory/Model/StockStateProvider.php +++ b/app/code/Magento/CatalogInventory/Model/StockStateProvider.php @@ -9,9 +9,9 @@ use Magento\Catalog\Model\ProductFactory; use Magento\CatalogInventory\Api\Data\StockItemInterface; use Magento\CatalogInventory\Model\Spi\StockStateProviderInterface; +use Magento\Framework\DataObject\Factory as ObjectFactory; use Magento\Framework\Locale\FormatInterface; use Magento\Framework\Math\Division as MathDivision; -use Magento\Framework\DataObject\Factory as ObjectFactory; /** * Interface StockStateProvider @@ -65,6 +65,8 @@ public function __construct( } /** + * Validate stock + * * @param StockItemInterface $stockItem * @return bool */ @@ -82,6 +84,8 @@ public function verifyStock(StockItemInterface $stockItem) } /** + * Verify notification + * * @param StockItemInterface $stockItem * @return bool */ @@ -91,6 +95,8 @@ public function verifyNotification(StockItemInterface $stockItem) } /** + * Validate quote qty + * * @param StockItemInterface $stockItem * @param int|float $qty * @param int|float $summaryQty @@ -113,13 +119,13 @@ public function checkQuoteItemQty(StockItemInterface $stockItem, $qty, $summaryQ $result->setItemIsQtyDecimal($stockItem->getIsQtyDecimal()); if (!$stockItem->getIsQtyDecimal()) { $result->setHasQtyOptionUpdate(true); - $qty = intval($qty); + $qty = (int) $qty; /** * Adding stock data to quote item */ $result->setItemQty($qty); $qty = $this->getNumber($qty); - $origQty = intval($origQty); + $origQty = (int) $origQty; $result->setOrigQty($origQty); } @@ -254,6 +260,8 @@ public function checkQty(StockItemInterface $stockItem, $qty) } /** + * Returns suggested qty + * * Returns suggested qty that satisfies qty increments and minQty/maxQty/minSaleQty/maxSaleQty conditions * or original qty if such value does not exist * @@ -294,6 +302,8 @@ public function suggestQty(StockItemInterface $stockItem, $qty) } /** + * Check Qty Increments + * * @param StockItemInterface $stockItem * @param float|int $qty * @return \Magento\Framework\DataObject @@ -369,6 +379,8 @@ public function getStockQty(StockItemInterface $stockItem) } /** + * Get numeric qty + * * @param string|float|int|null $qty * @return float|null */ diff --git a/app/code/Magento/CatalogWidget/Block/Product/ProductsList.php b/app/code/Magento/CatalogWidget/Block/Product/ProductsList.php index 9a55f981b76..4765a54cf0f 100644 --- a/app/code/Magento/CatalogWidget/Block/Product/ProductsList.php +++ b/app/code/Magento/CatalogWidget/Block/Product/ProductsList.php @@ -14,6 +14,7 @@ /** * Catalog Products List widget block + * * Class ProductsList * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ @@ -130,7 +131,7 @@ public function __construct( } /** - * {@inheritdoc} + * @inheritdoc */ protected function _construct() { @@ -164,7 +165,7 @@ public function getCacheKeyInfo() $this->_storeManager->getStore()->getId(), $this->_design->getDesignTheme()->getId(), $this->httpContext->getValue(\Magento\Customer\Model\Context::CONTEXT_GROUP), - intval($this->getRequest()->getParam($this->getData('page_var_name'), 1)), + (int) $this->getRequest()->getParam($this->getData('page_var_name'), 1), $this->getProductsPerPage(), $conditions, $this->json->serialize($this->getRequest()->getParams()), @@ -174,7 +175,7 @@ public function getCacheKeyInfo() } /** - * {@inheritdoc} + * @inheritdoc * @SuppressWarnings(PHPMD.NPathComplexity) */ public function getProductPriceHtml( @@ -211,7 +212,7 @@ public function getProductPriceHtml( } /** - * {@inheritdoc} + * @inheritdoc */ protected function _beforeToHtml() { @@ -249,6 +250,8 @@ public function createCollection() } /** + * Returns conditions + * * @return \Magento\Rule\Model\Condition\Combine */ protected function getConditions() @@ -386,6 +389,8 @@ public function getTitle() } /** + * Returns PriceCurrencyInterface instance + * * @return PriceCurrencyInterface * * @deprecated 100.2.0 diff --git a/app/code/Magento/Config/Block/System/Config/Form/Field/Datetime.php b/app/code/Magento/Config/Block/System/Config/Form/Field/Datetime.php index 63dbb2b80e3..16b18e02000 100644 --- a/app/code/Magento/Config/Block/System/Config/Form/Field/Datetime.php +++ b/app/code/Magento/Config/Block/System/Config/Form/Field/Datetime.php @@ -33,6 +33,8 @@ public function __construct( } /** + * Returns element html + * * @param AbstractElement $element * @return string * @codeCoverageIgnore @@ -40,7 +42,7 @@ public function __construct( protected function _getElementHtml(AbstractElement $element) { return $this->dateTimeFormatter->formatObject( - $this->_localeDate->date(intval($element->getValue())), + $this->_localeDate->date((int) $element->getValue()), $this->_localeDate->getDateTimeFormat(\IntlDateFormatter::MEDIUM) ); } diff --git a/app/code/Magento/Config/Block/System/Config/Form/Field/Notification.php b/app/code/Magento/Config/Block/System/Config/Form/Field/Notification.php index 7f21bf4b92b..2e79cec7088 100644 --- a/app/code/Magento/Config/Block/System/Config/Form/Field/Notification.php +++ b/app/code/Magento/Config/Block/System/Config/Form/Field/Notification.php @@ -10,6 +10,7 @@ /** * Backend system config datetime field renderer + * * @api * @since 100.0.2 */ @@ -35,6 +36,8 @@ public function __construct( } /** + * Returns element html + * * @param AbstractElement $element * @return string */ @@ -44,6 +47,6 @@ protected function _getElementHtml(AbstractElement $element) $format = $this->_localeDate->getDateTimeFormat( \IntlDateFormatter::MEDIUM ); - return $this->dateTimeFormatter->formatObject($this->_localeDate->date(intval($element->getValue())), $format); + return $this->dateTimeFormatter->formatObject($this->_localeDate->date((int) $element->getValue()), $format); } } diff --git a/app/code/Magento/Sales/Model/Order.php b/app/code/Magento/Sales/Model/Order.php index 7372d9715c7..9f30342ed33 100644 --- a/app/code/Magento/Sales/Model/Order.php +++ b/app/code/Magento/Sales/Model/Order.php @@ -16,7 +16,7 @@ use Magento\Sales\Model\ResourceModel\Order\Address\Collection; use Magento\Sales\Model\ResourceModel\Order\Creditmemo\Collection as CreditmemoCollection; use Magento\Sales\Model\ResourceModel\Order\Invoice\Collection as InvoiceCollection; -use Magento\Sales\Model\ResourceModel\Order\Item\Collection as ImportCollection; +use Magento\Sales\Model\ResourceModel\Order\Item\Collection as ItemCollection; use Magento\Sales\Model\ResourceModel\Order\Payment\Collection as PaymentCollection; use Magento\Sales\Model\ResourceModel\Order\Shipment\Collection as ShipmentCollection; use Magento\Sales\Model\ResourceModel\Order\Shipment\Track\Collection as TrackCollection; @@ -564,6 +564,7 @@ public function canCancel() /** * Getter whether the payment can be voided + * * @return bool */ public function canVoidPayment() @@ -880,7 +881,7 @@ protected function _placePayment() } /** - * {@inheritdoc} + * @inheritdoc */ public function getPayment() { @@ -1008,6 +1009,7 @@ public function addStatusToHistory($status, $comment = '', $isCustomerNotified = /** * Add a comment to order + * * Different or default status may be specified * * @param string $comment @@ -1023,6 +1025,7 @@ public function addStatusHistoryComment($comment, $status = false) /** * Add a comment to order status history + * * Different or default status may be specified * * @param string $comment @@ -1088,6 +1091,8 @@ public function place() } /** + * Hold order + * * @return $this * @throws \Magento\Framework\Exception\LocalizedException */ @@ -1233,6 +1238,8 @@ public function getShippingMethod($asObject = false) /*********************** ADDRESSES ***************************/ /** + * Returns address collection instance + * * @return Collection */ public function getAddressesCollection() @@ -1247,6 +1254,8 @@ public function getAddressesCollection() } /** + * Returns address by id + * * @param mixed $addressId * @return false */ @@ -1261,6 +1270,8 @@ public function getAddressById($addressId) } /** + * Add address to order + * * @param \Magento\Sales\Model\Order\Address $address * @return $this */ @@ -1275,9 +1286,11 @@ public function addAddress(\Magento\Sales\Model\Order\Address $address) } /** + * Returns items collection + * * @param array $filterByTypes * @param bool $nonChildrenOnly - * @return ImportCollection + * @return ItemCollection */ public function getItemsCollection($filterByTypes = [], $nonChildrenOnly = false) { @@ -1302,7 +1315,7 @@ public function getItemsCollection($filterByTypes = [], $nonChildrenOnly = false * Get random items collection without related children * * @param int $limit - * @return ImportCollection + * @return ItemCollection */ public function getParentItemsRandomCollection($limit = 1) { @@ -1314,7 +1327,7 @@ public function getParentItemsRandomCollection($limit = 1) * * @param int $limit * @param bool $nonChildrenOnly - * @return ImportCollection + * @return ItemCollection */ protected function _getItemsRandomCollection($limit, $nonChildrenOnly = false) { @@ -1347,6 +1360,8 @@ protected function _getItemsRandomCollection($limit, $nonChildrenOnly = false) } /** + * Returns all order items + * * @return \Magento\Sales\Model\Order\Item[] */ public function getAllItems() @@ -1361,6 +1376,8 @@ public function getAllItems() } /** + * Returns all visible items + * * @return array */ public function getAllVisibleItems() @@ -1392,6 +1409,8 @@ public function getItemById($itemId) } /** + * Returns Item By QuoteItem Id + * * @param mixed $quoteItemId * @return \Magento\Framework\DataObject|null */ @@ -1406,6 +1425,8 @@ public function getItemByQuoteItemId($quoteItemId) } /** + * Add item to order + * * @param \Magento\Sales\Model\Order\Item $item * @return $this */ @@ -1421,6 +1442,8 @@ public function addItem(\Magento\Sales\Model\Order\Item $item) /*********************** PAYMENTS ***************************/ /** + * Returns payment collection + * * @return PaymentCollection */ public function getPaymentsCollection() @@ -1435,6 +1458,8 @@ public function getPaymentsCollection() } /** + * Returns all payments + * * @return array */ public function getAllPayments() @@ -1449,6 +1474,8 @@ public function getAllPayments() } /** + * Returns payment by id + * * @param mixed $paymentId * @return Payment|false */ @@ -1463,7 +1490,7 @@ public function getPaymentById($paymentId) } /** - * {@inheritdoc} + * @inheritdoc */ public function setPayment(\Magento\Sales\Api\Data\OrderPaymentInterface $payment = null) { @@ -1530,6 +1557,8 @@ public function getVisibleStatusHistory() } /** + * Returns status history by id + * * @param mixed $statusId * @return string|false */ @@ -1545,6 +1574,7 @@ public function getStatusHistoryById($statusId) /** * Set the order status history object and the order object to each other + * * Adds the object to the status history collection, which is automatically saved when the order is saved. * See the entity_id attribute backend model. * Or the history record can be saved standalone after this. @@ -1564,6 +1594,8 @@ public function addStatusHistory(\Magento\Sales\Model\Order\Status\History $hist } /** + * Returns real order id + * * @return string */ public function getRealOrderId() @@ -1592,9 +1624,9 @@ public function getOrderCurrency() /** * Get formatted price value including order currency rate to order website currency * - * @param float $price - * @param bool $addBrackets - * @return string + * @param float $price + * @param bool $addBrackets + * @return string */ public function formatPrice($price, $addBrackets = false) { @@ -1602,6 +1634,8 @@ public function formatPrice($price, $addBrackets = false) } /** + * Format price precision + * * @param float $price * @param int $precision * @param bool $addBrackets @@ -1615,8 +1649,8 @@ public function formatPricePrecision($price, $precision, $addBrackets = false) /** * Retrieve text formatted price value including order rate * - * @param float $price - * @return string + * @param float $price + * @return string */ public function formatPriceTxt($price) { @@ -1637,6 +1671,8 @@ public function getBaseCurrency() } /** + * Format base price + * * @param float $price * @return string */ @@ -1646,6 +1682,8 @@ public function formatBasePrice($price) } /** + * Format Base Price Precision + * * @param float $price * @param int $precision * @return string @@ -1656,6 +1694,8 @@ public function formatBasePricePrecision($price, $precision) } /** + * Is Currency Different + * * @return bool */ public function isCurrencyDifferent() @@ -1688,6 +1728,8 @@ public function getBaseTotalDue() } /** + * Returns object data + * * @param string $key * @param null|string|int $index * @return mixed @@ -1828,6 +1870,8 @@ public function getRelatedObjects() } /** + * Returns customer name + * * @return string */ public function getCustomerName() @@ -1855,8 +1899,8 @@ public function addRelatedObject(\Magento\Framework\Model\AbstractModel $object) /** * Get formatted order created date in store timezone * - * @param string $format date format type (short|medium|long|full) - * @return string + * @param string $format date format type (short|medium|long|full) + * @return string */ public function getCreatedAtFormatted($format) { @@ -1870,6 +1914,8 @@ public function getCreatedAtFormatted($format) } /** + * Returns email customer note + * * @return string */ public function getEmailCustomerNote() @@ -1881,6 +1927,8 @@ public function getEmailCustomerNote() } /** + * Returns store group name + * * @return string */ public function getStoreGroupName() @@ -1894,7 +1942,8 @@ public function getStoreGroupName() /** * Resets all data in object - * so after another load it will be complete new object + * + * So after another load it will be complete new object * * @return $this */ @@ -1918,6 +1967,8 @@ public function reset() } /** + * Get order is not virtual + * * @return bool * @SuppressWarnings(PHPMD.BooleanGetMethodName) */ @@ -1960,6 +2011,8 @@ public function getIncrementId() } /** + * Returns order items + * * @return \Magento\Sales\Api\Data\OrderItemInterface[] */ public function getItems() @@ -1974,7 +2027,7 @@ public function getItems() } /** - * {@inheritdoc} + * @inheritdoc * @codeCoverageIgnore */ public function setItems($items) @@ -1983,6 +2036,8 @@ public function setItems($items) } /** + * Returns order addresses + * * @return \Magento\Sales\Api\Data\OrderAddressInterface[] */ public function getAddresses() @@ -1997,6 +2052,8 @@ public function getAddresses() } /** + * Returns status history + * * @return \Magento\Sales\Api\Data\OrderStatusHistoryInterface[]|null */ public function getStatusHistories() @@ -2011,7 +2068,7 @@ public function getStatusHistories() } /** - * {@inheritdoc} + * @inheritdoc * * @return \Magento\Sales\Api\Data\OrderExtensionInterface|null */ @@ -2021,7 +2078,7 @@ public function getExtensionAttributes() } /** - * {@inheritdoc} + * @inheritdoc * * @param \Magento\Sales\Api\Data\OrderExtensionInterface $extensionAttributes * @return $this @@ -2504,7 +2561,7 @@ public function getCreatedAt() } /** - * {@inheritdoc} + * @inheritdoc */ public function setCreatedAt($createdAt) { @@ -3322,7 +3379,7 @@ public function getXForwardedFor() } /** - * {@inheritdoc} + * @inheritdoc */ public function setStatusHistories(array $statusHistories = null) { @@ -3330,7 +3387,7 @@ public function setStatusHistories(array $statusHistories = null) } /** - * {@inheritdoc} + * @inheritdoc */ public function setStatus($status) { @@ -3338,7 +3395,7 @@ public function setStatus($status) } /** - * {@inheritdoc} + * @inheritdoc */ public function setCouponCode($code) { @@ -3346,7 +3403,7 @@ public function setCouponCode($code) } /** - * {@inheritdoc} + * @inheritdoc */ public function setProtectCode($code) { @@ -3354,7 +3411,7 @@ public function setProtectCode($code) } /** - * {@inheritdoc} + * @inheritdoc */ public function setShippingDescription($description) { @@ -3362,7 +3419,7 @@ public function setShippingDescription($description) } /** - * {@inheritdoc} + * @inheritdoc */ public function setIsVirtual($isVirtual) { @@ -3370,7 +3427,7 @@ public function setIsVirtual($isVirtual) } /** - * {@inheritdoc} + * @inheritdoc */ public function setStoreId($id) { @@ -3378,7 +3435,7 @@ public function setStoreId($id) } /** - * {@inheritdoc} + * @inheritdoc */ public function setCustomerId($id) { @@ -3386,7 +3443,7 @@ public function setCustomerId($id) } /** - * {@inheritdoc} + * @inheritdoc */ public function setBaseDiscountAmount($amount) { @@ -3394,7 +3451,7 @@ public function setBaseDiscountAmount($amount) } /** - * {@inheritdoc} + * @inheritdoc */ public function setBaseDiscountCanceled($baseDiscountCanceled) { @@ -3402,7 +3459,7 @@ public function setBaseDiscountCanceled($baseDiscountCanceled) } /** - * {@inheritdoc} + * @inheritdoc */ public function setBaseDiscountInvoiced($baseDiscountInvoiced) { @@ -3410,7 +3467,7 @@ public function setBaseDiscountInvoiced($baseDiscountInvoiced) } /** - * {@inheritdoc} + * @inheritdoc */ public function setBaseDiscountRefunded($baseDiscountRefunded) { @@ -3418,7 +3475,7 @@ public function setBaseDiscountRefunded($baseDiscountRefunded) } /** - * {@inheritdoc} + * @inheritdoc */ public function setBaseGrandTotal($amount) { @@ -3426,7 +3483,7 @@ public function setBaseGrandTotal($amount) } /** - * {@inheritdoc} + * @inheritdoc */ public function setBaseShippingAmount($amount) { @@ -3434,7 +3491,7 @@ public function setBaseShippingAmount($amount) } /** - * {@inheritdoc} + * @inheritdoc */ public function setBaseShippingCanceled($baseShippingCanceled) { @@ -3442,7 +3499,7 @@ public function setBaseShippingCanceled($baseShippingCanceled) } /** - * {@inheritdoc} + * @inheritdoc */ public function setBaseShippingInvoiced($baseShippingInvoiced) { @@ -3450,7 +3507,7 @@ public function setBaseShippingInvoiced($baseShippingInvoiced) } /** - * {@inheritdoc} + * @inheritdoc */ public function setBaseShippingRefunded($baseShippingRefunded) { @@ -3458,7 +3515,7 @@ public function setBaseShippingRefunded($baseShippingRefunded) } /** - * {@inheritdoc} + * @inheritdoc */ public function setBaseShippingTaxAmount($amount) { @@ -3466,7 +3523,7 @@ public function setBaseShippingTaxAmount($amount) } /** - * {@inheritdoc} + * @inheritdoc */ public function setBaseShippingTaxRefunded($baseShippingTaxRefunded) { @@ -3474,7 +3531,7 @@ public function setBaseShippingTaxRefunded($baseShippingTaxRefunded) } /** - * {@inheritdoc} + * @inheritdoc */ public function setBaseSubtotal($amount) { @@ -3482,7 +3539,7 @@ public function setBaseSubtotal($amount) } /** - * {@inheritdoc} + * @inheritdoc */ public function setBaseSubtotalCanceled($baseSubtotalCanceled) { @@ -3490,7 +3547,7 @@ public function setBaseSubtotalCanceled($baseSubtotalCanceled) } /** - * {@inheritdoc} + * @inheritdoc */ public function setBaseSubtotalInvoiced($baseSubtotalInvoiced) { @@ -3498,7 +3555,7 @@ public function setBaseSubtotalInvoiced($baseSubtotalInvoiced) } /** - * {@inheritdoc} + * @inheritdoc */ public function setBaseSubtotalRefunded($baseSubtotalRefunded) { @@ -3506,7 +3563,7 @@ public function setBaseSubtotalRefunded($baseSubtotalRefunded) } /** - * {@inheritdoc} + * @inheritdoc */ public function setBaseTaxAmount($amount) { @@ -3514,7 +3571,7 @@ public function setBaseTaxAmount($amount) } /** - * {@inheritdoc} + * @inheritdoc */ public function setBaseTaxCanceled($baseTaxCanceled) { @@ -3522,7 +3579,7 @@ public function setBaseTaxCanceled($baseTaxCanceled) } /** - * {@inheritdoc} + * @inheritdoc */ public function setBaseTaxInvoiced($baseTaxInvoiced) { @@ -3530,7 +3587,7 @@ public function setBaseTaxInvoiced($baseTaxInvoiced) } /** - * {@inheritdoc} + * @inheritdoc */ public function setBaseTaxRefunded($baseTaxRefunded) { @@ -3538,7 +3595,7 @@ public function setBaseTaxRefunded($baseTaxRefunded) } /** - * {@inheritdoc} + * @inheritdoc */ public function setBaseToGlobalRate($rate) { @@ -3546,7 +3603,7 @@ public function setBaseToGlobalRate($rate) } /** - * {@inheritdoc} + * @inheritdoc */ public function setBaseToOrderRate($rate) { @@ -3554,7 +3611,7 @@ public function setBaseToOrderRate($rate) } /** - * {@inheritdoc} + * @inheritdoc */ public function setBaseTotalCanceled($baseTotalCanceled) { @@ -3562,7 +3619,7 @@ public function setBaseTotalCanceled($baseTotalCanceled) } /** - * {@inheritdoc} + * @inheritdoc */ public function setBaseTotalInvoiced($baseTotalInvoiced) { @@ -3570,7 +3627,7 @@ public function setBaseTotalInvoiced($baseTotalInvoiced) } /** - * {@inheritdoc} + * @inheritdoc */ public function setBaseTotalInvoicedCost($baseTotalInvoicedCost) { @@ -3578,7 +3635,7 @@ public function setBaseTotalInvoicedCost($baseTotalInvoicedCost) } /** - * {@inheritdoc} + * @inheritdoc */ public function setBaseTotalOfflineRefunded($baseTotalOfflineRefunded) { @@ -3586,7 +3643,7 @@ public function setBaseTotalOfflineRefunded($baseTotalOfflineRefunded) } /** - * {@inheritdoc} + * @inheritdoc */ public function setBaseTotalOnlineRefunded($baseTotalOnlineRefunded) { @@ -3594,7 +3651,7 @@ public function setBaseTotalOnlineRefunded($baseTotalOnlineRefunded) } /** - * {@inheritdoc} + * @inheritdoc */ public function setBaseTotalPaid($baseTotalPaid) { @@ -3602,7 +3659,7 @@ public function setBaseTotalPaid($baseTotalPaid) } /** - * {@inheritdoc} + * @inheritdoc */ public function setBaseTotalQtyOrdered($baseTotalQtyOrdered) { @@ -3610,7 +3667,7 @@ public function setBaseTotalQtyOrdered($baseTotalQtyOrdered) } /** - * {@inheritdoc} + * @inheritdoc */ public function setBaseTotalRefunded($baseTotalRefunded) { @@ -3618,7 +3675,7 @@ public function setBaseTotalRefunded($baseTotalRefunded) } /** - * {@inheritdoc} + * @inheritdoc */ public function setDiscountAmount($amount) { @@ -3626,7 +3683,7 @@ public function setDiscountAmount($amount) } /** - * {@inheritdoc} + * @inheritdoc */ public function setDiscountCanceled($discountCanceled) { @@ -3634,7 +3691,7 @@ public function setDiscountCanceled($discountCanceled) } /** - * {@inheritdoc} + * @inheritdoc */ public function setDiscountInvoiced($discountInvoiced) { @@ -3642,7 +3699,7 @@ public function setDiscountInvoiced($discountInvoiced) } /** - * {@inheritdoc} + * @inheritdoc */ public function setDiscountRefunded($discountRefunded) { @@ -3650,7 +3707,7 @@ public function setDiscountRefunded($discountRefunded) } /** - * {@inheritdoc} + * @inheritdoc */ public function setGrandTotal($amount) { @@ -3658,7 +3715,7 @@ public function setGrandTotal($amount) } /** - * {@inheritdoc} + * @inheritdoc */ public function setShippingAmount($amount) { @@ -3666,7 +3723,7 @@ public function setShippingAmount($amount) } /** - * {@inheritdoc} + * @inheritdoc */ public function setShippingCanceled($shippingCanceled) { @@ -3674,7 +3731,7 @@ public function setShippingCanceled($shippingCanceled) } /** - * {@inheritdoc} + * @inheritdoc */ public function setShippingInvoiced($shippingInvoiced) { @@ -3682,7 +3739,7 @@ public function setShippingInvoiced($shippingInvoiced) } /** - * {@inheritdoc} + * @inheritdoc */ public function setShippingRefunded($shippingRefunded) { @@ -3690,7 +3747,7 @@ public function setShippingRefunded($shippingRefunded) } /** - * {@inheritdoc} + * @inheritdoc */ public function setShippingTaxAmount($amount) { @@ -3698,7 +3755,7 @@ public function setShippingTaxAmount($amount) } /** - * {@inheritdoc} + * @inheritdoc */ public function setShippingTaxRefunded($shippingTaxRefunded) { @@ -3706,7 +3763,7 @@ public function setShippingTaxRefunded($shippingTaxRefunded) } /** - * {@inheritdoc} + * @inheritdoc */ public function setStoreToBaseRate($rate) { @@ -3714,7 +3771,7 @@ public function setStoreToBaseRate($rate) } /** - * {@inheritdoc} + * @inheritdoc */ public function setStoreToOrderRate($rate) { @@ -3722,7 +3779,7 @@ public function setStoreToOrderRate($rate) } /** - * {@inheritdoc} + * @inheritdoc */ public function setSubtotal($amount) { @@ -3730,7 +3787,7 @@ public function setSubtotal($amount) } /** - * {@inheritdoc} + * @inheritdoc */ public function setSubtotalCanceled($subtotalCanceled) { @@ -3738,7 +3795,7 @@ public function setSubtotalCanceled($subtotalCanceled) } /** - * {@inheritdoc} + * @inheritdoc */ public function setSubtotalInvoiced($subtotalInvoiced) { @@ -3746,7 +3803,7 @@ public function setSubtotalInvoiced($subtotalInvoiced) } /** - * {@inheritdoc} + * @inheritdoc */ public function setSubtotalRefunded($subtotalRefunded) { @@ -3754,7 +3811,7 @@ public function setSubtotalRefunded($subtotalRefunded) } /** - * {@inheritdoc} + * @inheritdoc */ public function setTaxAmount($amount) { @@ -3762,7 +3819,7 @@ public function setTaxAmount($amount) } /** - * {@inheritdoc} + * @inheritdoc */ public function setTaxCanceled($taxCanceled) { @@ -3770,7 +3827,7 @@ public function setTaxCanceled($taxCanceled) } /** - * {@inheritdoc} + * @inheritdoc */ public function setTaxInvoiced($taxInvoiced) { @@ -3778,7 +3835,7 @@ public function setTaxInvoiced($taxInvoiced) } /** - * {@inheritdoc} + * @inheritdoc */ public function setTaxRefunded($taxRefunded) { @@ -3786,7 +3843,7 @@ public function setTaxRefunded($taxRefunded) } /** - * {@inheritdoc} + * @inheritdoc */ public function setTotalCanceled($totalCanceled) { @@ -3794,7 +3851,7 @@ public function setTotalCanceled($totalCanceled) } /** - * {@inheritdoc} + * @inheritdoc */ public function setTotalInvoiced($totalInvoiced) { @@ -3802,7 +3859,7 @@ public function setTotalInvoiced($totalInvoiced) } /** - * {@inheritdoc} + * @inheritdoc */ public function setTotalOfflineRefunded($totalOfflineRefunded) { @@ -3810,7 +3867,7 @@ public function setTotalOfflineRefunded($totalOfflineRefunded) } /** - * {@inheritdoc} + * @inheritdoc */ public function setTotalOnlineRefunded($totalOnlineRefunded) { @@ -3818,7 +3875,7 @@ public function setTotalOnlineRefunded($totalOnlineRefunded) } /** - * {@inheritdoc} + * @inheritdoc */ public function setTotalPaid($totalPaid) { @@ -3826,7 +3883,7 @@ public function setTotalPaid($totalPaid) } /** - * {@inheritdoc} + * @inheritdoc */ public function setTotalQtyOrdered($totalQtyOrdered) { @@ -3834,7 +3891,7 @@ public function setTotalQtyOrdered($totalQtyOrdered) } /** - * {@inheritdoc} + * @inheritdoc */ public function setTotalRefunded($totalRefunded) { @@ -3842,7 +3899,7 @@ public function setTotalRefunded($totalRefunded) } /** - * {@inheritdoc} + * @inheritdoc */ public function setCanShipPartially($flag) { @@ -3850,7 +3907,7 @@ public function setCanShipPartially($flag) } /** - * {@inheritdoc} + * @inheritdoc */ public function setCanShipPartiallyItem($flag) { @@ -3858,7 +3915,7 @@ public function setCanShipPartiallyItem($flag) } /** - * {@inheritdoc} + * @inheritdoc */ public function setCustomerIsGuest($customerIsGuest) { @@ -3866,7 +3923,7 @@ public function setCustomerIsGuest($customerIsGuest) } /** - * {@inheritdoc} + * @inheritdoc */ public function setCustomerNoteNotify($customerNoteNotify) { @@ -3874,7 +3931,7 @@ public function setCustomerNoteNotify($customerNoteNotify) } /** - * {@inheritdoc} + * @inheritdoc */ public function setBillingAddressId($id) { @@ -3882,7 +3939,7 @@ public function setBillingAddressId($id) } /** - * {@inheritdoc} + * @inheritdoc */ public function setCustomerGroupId($id) { @@ -3890,7 +3947,7 @@ public function setCustomerGroupId($id) } /** - * {@inheritdoc} + * @inheritdoc */ public function setEditIncrement($editIncrement) { @@ -3898,7 +3955,7 @@ public function setEditIncrement($editIncrement) } /** - * {@inheritdoc} + * @inheritdoc */ public function setEmailSent($emailSent) { @@ -3906,7 +3963,7 @@ public function setEmailSent($emailSent) } /** - * {@inheritdoc} + * @inheritdoc */ public function setForcedShipmentWithInvoice($forcedShipmentWithInvoice) { @@ -3914,7 +3971,7 @@ public function setForcedShipmentWithInvoice($forcedShipmentWithInvoice) } /** - * {@inheritdoc} + * @inheritdoc */ public function setPaymentAuthExpiration($paymentAuthExpiration) { @@ -3922,7 +3979,7 @@ public function setPaymentAuthExpiration($paymentAuthExpiration) } /** - * {@inheritdoc} + * @inheritdoc */ public function setQuoteAddressId($id) { @@ -3930,7 +3987,7 @@ public function setQuoteAddressId($id) } /** - * {@inheritdoc} + * @inheritdoc */ public function setQuoteId($id) { @@ -3938,7 +3995,7 @@ public function setQuoteId($id) } /** - * {@inheritdoc} + * @inheritdoc */ public function setAdjustmentNegative($adjustmentNegative) { @@ -3946,7 +4003,7 @@ public function setAdjustmentNegative($adjustmentNegative) } /** - * {@inheritdoc} + * @inheritdoc */ public function setAdjustmentPositive($adjustmentPositive) { @@ -3954,7 +4011,7 @@ public function setAdjustmentPositive($adjustmentPositive) } /** - * {@inheritdoc} + * @inheritdoc */ public function setBaseAdjustmentNegative($baseAdjustmentNegative) { @@ -3962,7 +4019,7 @@ public function setBaseAdjustmentNegative($baseAdjustmentNegative) } /** - * {@inheritdoc} + * @inheritdoc */ public function setBaseAdjustmentPositive($baseAdjustmentPositive) { @@ -3970,7 +4027,7 @@ public function setBaseAdjustmentPositive($baseAdjustmentPositive) } /** - * {@inheritdoc} + * @inheritdoc */ public function setBaseShippingDiscountAmount($amount) { @@ -3978,7 +4035,7 @@ public function setBaseShippingDiscountAmount($amount) } /** - * {@inheritdoc} + * @inheritdoc */ public function setBaseSubtotalInclTax($amount) { @@ -3986,7 +4043,7 @@ public function setBaseSubtotalInclTax($amount) } /** - * {@inheritdoc} + * @inheritdoc */ public function setBaseTotalDue($baseTotalDue) { @@ -3994,7 +4051,7 @@ public function setBaseTotalDue($baseTotalDue) } /** - * {@inheritdoc} + * @inheritdoc */ public function setPaymentAuthorizationAmount($amount) { @@ -4002,7 +4059,7 @@ public function setPaymentAuthorizationAmount($amount) } /** - * {@inheritdoc} + * @inheritdoc */ public function setShippingDiscountAmount($amount) { @@ -4010,7 +4067,7 @@ public function setShippingDiscountAmount($amount) } /** - * {@inheritdoc} + * @inheritdoc */ public function setSubtotalInclTax($amount) { @@ -4018,7 +4075,7 @@ public function setSubtotalInclTax($amount) } /** - * {@inheritdoc} + * @inheritdoc */ public function setTotalDue($totalDue) { @@ -4026,7 +4083,7 @@ public function setTotalDue($totalDue) } /** - * {@inheritdoc} + * @inheritdoc */ public function setWeight($weight) { @@ -4034,7 +4091,7 @@ public function setWeight($weight) } /** - * {@inheritdoc} + * @inheritdoc */ public function setCustomerDob($customerDob) { @@ -4042,7 +4099,7 @@ public function setCustomerDob($customerDob) } /** - * {@inheritdoc} + * @inheritdoc */ public function setIncrementId($id) { @@ -4050,7 +4107,7 @@ public function setIncrementId($id) } /** - * {@inheritdoc} + * @inheritdoc */ public function setAppliedRuleIds($appliedRuleIds) { @@ -4058,7 +4115,7 @@ public function setAppliedRuleIds($appliedRuleIds) } /** - * {@inheritdoc} + * @inheritdoc */ public function setBaseCurrencyCode($code) { @@ -4066,7 +4123,7 @@ public function setBaseCurrencyCode($code) } /** - * {@inheritdoc} + * @inheritdoc */ public function setCustomerEmail($customerEmail) { @@ -4074,7 +4131,7 @@ public function setCustomerEmail($customerEmail) } /** - * {@inheritdoc} + * @inheritdoc */ public function setCustomerFirstname($customerFirstname) { @@ -4082,7 +4139,7 @@ public function setCustomerFirstname($customerFirstname) } /** - * {@inheritdoc} + * @inheritdoc */ public function setCustomerLastname($customerLastname) { @@ -4090,7 +4147,7 @@ public function setCustomerLastname($customerLastname) } /** - * {@inheritdoc} + * @inheritdoc */ public function setCustomerMiddlename($customerMiddlename) { @@ -4098,7 +4155,7 @@ public function setCustomerMiddlename($customerMiddlename) } /** - * {@inheritdoc} + * @inheritdoc */ public function setCustomerPrefix($customerPrefix) { @@ -4106,7 +4163,7 @@ public function setCustomerPrefix($customerPrefix) } /** - * {@inheritdoc} + * @inheritdoc */ public function setCustomerSuffix($customerSuffix) { @@ -4114,7 +4171,7 @@ public function setCustomerSuffix($customerSuffix) } /** - * {@inheritdoc} + * @inheritdoc */ public function setCustomerTaxvat($customerTaxvat) { @@ -4122,7 +4179,7 @@ public function setCustomerTaxvat($customerTaxvat) } /** - * {@inheritdoc} + * @inheritdoc */ public function setDiscountDescription($description) { @@ -4130,7 +4187,7 @@ public function setDiscountDescription($description) } /** - * {@inheritdoc} + * @inheritdoc */ public function setExtCustomerId($id) { @@ -4138,7 +4195,7 @@ public function setExtCustomerId($id) } /** - * {@inheritdoc} + * @inheritdoc */ public function setExtOrderId($id) { @@ -4146,7 +4203,7 @@ public function setExtOrderId($id) } /** - * {@inheritdoc} + * @inheritdoc */ public function setGlobalCurrencyCode($code) { @@ -4154,7 +4211,7 @@ public function setGlobalCurrencyCode($code) } /** - * {@inheritdoc} + * @inheritdoc */ public function setHoldBeforeState($holdBeforeState) { @@ -4162,7 +4219,7 @@ public function setHoldBeforeState($holdBeforeState) } /** - * {@inheritdoc} + * @inheritdoc */ public function setHoldBeforeStatus($holdBeforeStatus) { @@ -4170,7 +4227,7 @@ public function setHoldBeforeStatus($holdBeforeStatus) } /** - * {@inheritdoc} + * @inheritdoc */ public function setOrderCurrencyCode($code) { @@ -4178,7 +4235,7 @@ public function setOrderCurrencyCode($code) } /** - * {@inheritdoc} + * @inheritdoc */ public function setOriginalIncrementId($id) { @@ -4186,7 +4243,7 @@ public function setOriginalIncrementId($id) } /** - * {@inheritdoc} + * @inheritdoc */ public function setRelationChildId($id) { @@ -4194,7 +4251,7 @@ public function setRelationChildId($id) } /** - * {@inheritdoc} + * @inheritdoc */ public function setRelationChildRealId($realId) { @@ -4202,7 +4259,7 @@ public function setRelationChildRealId($realId) } /** - * {@inheritdoc} + * @inheritdoc */ public function setRelationParentId($id) { @@ -4210,7 +4267,7 @@ public function setRelationParentId($id) } /** - * {@inheritdoc} + * @inheritdoc */ public function setRelationParentRealId($realId) { @@ -4218,7 +4275,7 @@ public function setRelationParentRealId($realId) } /** - * {@inheritdoc} + * @inheritdoc */ public function setRemoteIp($remoteIp) { @@ -4226,7 +4283,7 @@ public function setRemoteIp($remoteIp) } /** - * {@inheritdoc} + * @inheritdoc */ public function setStoreCurrencyCode($code) { @@ -4234,7 +4291,7 @@ public function setStoreCurrencyCode($code) } /** - * {@inheritdoc} + * @inheritdoc */ public function setStoreName($storeName) { @@ -4242,7 +4299,7 @@ public function setStoreName($storeName) } /** - * {@inheritdoc} + * @inheritdoc */ public function setXForwardedFor($xForwardedFor) { @@ -4250,7 +4307,7 @@ public function setXForwardedFor($xForwardedFor) } /** - * {@inheritdoc} + * @inheritdoc */ public function setCustomerNote($customerNote) { @@ -4258,7 +4315,7 @@ public function setCustomerNote($customerNote) } /** - * {@inheritdoc} + * @inheritdoc */ public function setUpdatedAt($timestamp) { @@ -4266,7 +4323,7 @@ public function setUpdatedAt($timestamp) } /** - * {@inheritdoc} + * @inheritdoc */ public function setTotalItemCount($totalItemCount) { @@ -4274,7 +4331,7 @@ public function setTotalItemCount($totalItemCount) } /** - * {@inheritdoc} + * @inheritdoc */ public function setCustomerGender($customerGender) { @@ -4282,7 +4339,7 @@ public function setCustomerGender($customerGender) } /** - * {@inheritdoc} + * @inheritdoc */ public function setDiscountTaxCompensationAmount($amount) { @@ -4290,7 +4347,7 @@ public function setDiscountTaxCompensationAmount($amount) } /** - * {@inheritdoc} + * @inheritdoc */ public function setBaseDiscountTaxCompensationAmount($amount) { @@ -4298,7 +4355,7 @@ public function setBaseDiscountTaxCompensationAmount($amount) } /** - * {@inheritdoc} + * @inheritdoc */ public function setShippingDiscountTaxCompensationAmount($amount) { @@ -4306,7 +4363,7 @@ public function setShippingDiscountTaxCompensationAmount($amount) } /** - * {@inheritdoc} + * @inheritdoc */ public function setBaseShippingDiscountTaxCompensationAmnt($amnt) { @@ -4314,7 +4371,7 @@ public function setBaseShippingDiscountTaxCompensationAmnt($amnt) } /** - * {@inheritdoc} + * @inheritdoc */ public function setDiscountTaxCompensationInvoiced($discountTaxCompensationInvoiced) { @@ -4322,7 +4379,7 @@ public function setDiscountTaxCompensationInvoiced($discountTaxCompensationInvoi } /** - * {@inheritdoc} + * @inheritdoc */ public function setBaseDiscountTaxCompensationInvoiced($baseDiscountTaxCompensationInvoiced) { @@ -4333,7 +4390,7 @@ public function setBaseDiscountTaxCompensationInvoiced($baseDiscountTaxCompensat } /** - * {@inheritdoc} + * @inheritdoc */ public function setDiscountTaxCompensationRefunded($discountTaxCompensationRefunded) { @@ -4344,7 +4401,7 @@ public function setDiscountTaxCompensationRefunded($discountTaxCompensationRefun } /** - * {@inheritdoc} + * @inheritdoc */ public function setBaseDiscountTaxCompensationRefunded($baseDiscountTaxCompensationRefunded) { @@ -4355,7 +4412,7 @@ public function setBaseDiscountTaxCompensationRefunded($baseDiscountTaxCompensat } /** - * {@inheritdoc} + * @inheritdoc */ public function setShippingInclTax($amount) { @@ -4363,7 +4420,7 @@ public function setShippingInclTax($amount) } /** - * {@inheritdoc} + * @inheritdoc */ public function setBaseShippingInclTax($amount) { diff --git a/app/code/Magento/Sales/Test/Unit/Model/ValidatorResultMergerTest.php b/app/code/Magento/Sales/Test/Unit/Model/ValidatorResultMergerTest.php new file mode 100644 index 00000000000..4236890a2a3 --- /dev/null +++ b/app/code/Magento/Sales/Test/Unit/Model/ValidatorResultMergerTest.php @@ -0,0 +1,87 @@ +validatorResultFactoryMock = $this->getMockBuilder(ValidatorResultInterfaceFactory::class) + ->setMethods(['create'])->disableOriginalConstructor()->getMock(); + $this->objectManager = new ObjectManager($this); + $this->validatorResultMerger = $this->objectManager->getObject( + ValidatorResultMerger::class, + [ + 'validatorResultInterfaceFactory' => $this->validatorResultFactoryMock, + ] + ); + } + + /** + * Test merge method + * + * @return void + */ + public function testMerge() + { + $validatorResultMock = $this->createMock(ValidatorResultInterface::class); + $orderValidationResultMock = $this->createMock(ValidatorResultInterface::class); + $creditmemoValidationResultMock = $this->createMock(ValidatorResultInterface::class); + $itemsValidationMessages = [['test04', 'test05'], ['test06']]; + $this->validatorResultFactoryMock->expects($this->once())->method('create') + ->willReturn($validatorResultMock); + $orderValidationResultMock->expects($this->once())->method('getMessages')->willReturn(['test01', 'test02']); + $creditmemoValidationResultMock->expects($this->once())->method('getMessages')->willReturn(['test03']); + + $validatorResultMock->expects($this->at(0))->method('addMessage')->with('test01'); + $validatorResultMock->expects($this->at(1))->method('addMessage')->with('test02'); + $validatorResultMock->expects($this->at(2))->method('addMessage')->with('test03'); + $validatorResultMock->expects($this->at(3))->method('addMessage')->with('test04'); + $validatorResultMock->expects($this->at(4))->method('addMessage')->with('test05'); + $validatorResultMock->expects($this->at(5))->method('addMessage')->with('test06'); + $expected = $validatorResultMock; + $actual = $this->validatorResultMerger->merge( + $orderValidationResultMock, + $creditmemoValidationResultMock, + ...$itemsValidationMessages + ); + $this->assertEquals($expected, $actual); + } +} diff --git a/app/code/Magento/Sales/Test/Unit/Model/ValidatorResultTest.php b/app/code/Magento/Sales/Test/Unit/Model/ValidatorResultTest.php new file mode 100644 index 00000000000..f4ab2d4f48e --- /dev/null +++ b/app/code/Magento/Sales/Test/Unit/Model/ValidatorResultTest.php @@ -0,0 +1,75 @@ +objectManager = new ObjectManager($this); + $this->validatorResult = $this->objectManager->getObject(ValidatorResult::class); + } + + /** + * Test addMessage method + * + * @return void + */ + public function testAddMessages() + { + $messageFirst = 'Sample message 01.'; + $messageSecond = 'Sample messages 02.'; + $messageThird = 'Sample messages 03.'; + $expected = [$messageFirst, $messageSecond, $messageThird]; + $this->validatorResult->addMessage($messageFirst); + $this->validatorResult->addMessage($messageSecond); + $this->validatorResult->addMessage($messageThird); + $actual = $this->validatorResult->getMessages(); + $this->assertEquals($expected, $actual); + } + + /** + * Test hasMessages method + * + * @return void + */ + public function testHasMessages() + { + $this->assertFalse($this->validatorResult->hasMessages()); + $messageFirst = 'Sample message 01.'; + $messageSecond = 'Sample messages 02.'; + $this->validatorResult->addMessage($messageFirst); + $this->validatorResult->addMessage($messageSecond); + $this->assertTrue($this->validatorResult->hasMessages()); + } +} diff --git a/dev/tests/functional/lib/Magento/Mtf/Constraint/AbstractAssertForm.php b/dev/tests/functional/lib/Magento/Mtf/Constraint/AbstractAssertForm.php index eb04450d526..61e5b764930 100644 --- a/dev/tests/functional/lib/Magento/Mtf/Constraint/AbstractAssertForm.php +++ b/dev/tests/functional/lib/Magento/Mtf/Constraint/AbstractAssertForm.php @@ -53,7 +53,7 @@ protected function verifyData(array $fixtureData, array $formData, $isStrict = f } $formValue = isset($formData[$key]) ? $formData[$key] : null; if (is_numeric($formValue)) { - $formValue = floatval($formValue); + $formValue = (float)$formValue; } if (null === $formValue) { @@ -118,6 +118,7 @@ protected function sortData(array $data) /** * Sort multidimensional array by paths. + * * Pattern path: key/subKey::sortKey. * Example: * $data = [ @@ -150,7 +151,6 @@ protected function sortData(array $data) * * @param array $data * @param string $path - * @param string $path * @return array * @throws \Exception * diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/View/CustomOptions.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/View/CustomOptions.php index 9f05a4ade8a..dcc8cce9700 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/View/CustomOptions.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/View/CustomOptions.php @@ -231,7 +231,7 @@ protected function getFieldData(SimpleElement $option) return [ 'options' => [ [ - 'price' => floatval($price), + 'price' => (float)$price, 'max_characters' => $maxCharacters, ], ] @@ -262,7 +262,7 @@ protected function getFileData(SimpleElement $option) return [ 'options' => [ [ - 'price' => floatval($price), + 'price' => (float)$price, 'file_extension' => $this->getOptionNotice($option, 1), 'image_size_x' => preg_replace('/[^0-9]/', '', $this->getOptionNotice($option, 2)), 'image_size_y' => preg_replace('/[^0-9]/', '', $this->getOptionNotice($option, 3)), @@ -344,7 +344,7 @@ protected function getDateData(SimpleElement $option) return [ 'options' => [ [ - 'price' => floatval($price), + 'price' => (float)$price, ], ] ]; diff --git a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleForm.php b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleForm.php index 7db32337b99..17739f5524e 100644 --- a/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleForm.php +++ b/dev/tests/functional/tests/app/Magento/CatalogRule/Test/Constraint/AssertCatalogPriceRuleForm.php @@ -42,10 +42,10 @@ public function processAssert( $fixtureData = $catalogPriceRule->getData(); //convert discount_amount to float to compare if (isset($formData['discount_amount'])) { - $formData['discount_amount'] = floatval($formData['discount_amount']); + $formData['discount_amount'] = (float)$formData['discount_amount']; } if (isset($fixtureData['discount_amount'])) { - $fixtureData['discount_amount'] = floatval($fixtureData['discount_amount']); + $fixtureData['discount_amount'] = (float)$fixtureData['discount_amount']; } $diff = $this->verifyData($formData, $fixtureData); \PHPUnit\Framework\Assert::assertTrue( diff --git a/dev/tests/functional/tests/app/Magento/Downloadable/Test/Handler/DownloadableProduct/Webapi.php b/dev/tests/functional/tests/app/Magento/Downloadable/Test/Handler/DownloadableProduct/Webapi.php index 434c78e55c6..d14d6754b12 100644 --- a/dev/tests/functional/tests/app/Magento/Downloadable/Test/Handler/DownloadableProduct/Webapi.php +++ b/dev/tests/functional/tests/app/Magento/Downloadable/Test/Handler/DownloadableProduct/Webapi.php @@ -148,7 +148,7 @@ protected function prepareLinkData(array $link) 'title' => $link['title'], 'sort_order' => isset($link['sort_order']) ? $link['sort_order'] : 0, 'is_shareable' => $link['is_shareable'], - 'price' => floatval($link['price']), + 'price' => (float)$link['price'], 'number_of_downloads' => isset($link['number_of_downloads']) ? $link['number_of_downloads'] : 0, 'link_type' => $link['type'], 'link_url' => isset($link['link_url']) ? $link['link_url'] : null, diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/Constraint/AssertSalesReportIntervalResult.php b/dev/tests/functional/tests/app/Magento/Reports/Test/Constraint/AssertSalesReportIntervalResult.php index 745450aa2c0..1236a86e160 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/Constraint/AssertSalesReportIntervalResult.php +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/Constraint/AssertSalesReportIntervalResult.php @@ -52,7 +52,7 @@ protected function prepareSalesResult($salesResult) { $data = []; foreach ($salesResult as $key => $result) { - $data[$key] = floatval($result); + $data[$key] = (float)$result; } return $data; diff --git a/dev/tests/functional/tests/app/Magento/Reports/Test/Constraint/AssertSalesReportTotalResult.php b/dev/tests/functional/tests/app/Magento/Reports/Test/Constraint/AssertSalesReportTotalResult.php index 5f435e48229..423ca6dafbd 100644 --- a/dev/tests/functional/tests/app/Magento/Reports/Test/Constraint/AssertSalesReportTotalResult.php +++ b/dev/tests/functional/tests/app/Magento/Reports/Test/Constraint/AssertSalesReportTotalResult.php @@ -52,7 +52,7 @@ protected function prepareSalesResult($salesResult) { $data = []; foreach ($salesResult as $key => $result) { - $data[$key] = floatval($result); + $data[$key] = (float)$result; } return $data; diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductTest.php index a1260c0a7b1..c34120404a9 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductTest.php @@ -585,7 +585,7 @@ public function testGetOptions() continue; } foreach ($option->getValues() as $value) { - $this->assertEquals($expectedValue[$value->getSku()], floatval($value->getPrice())); + $this->assertEquals($expectedValue[$value->getSku()], (float)$value->getPrice()); } } } diff --git a/dev/tests/integration/testsuite/Magento/GiftMessage/Observer/SalesEventQuoteMergeTest.php b/dev/tests/integration/testsuite/Magento/GiftMessage/Observer/SalesEventQuoteMergeTest.php new file mode 100644 index 00000000000..0902c35568e --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/GiftMessage/Observer/SalesEventQuoteMergeTest.php @@ -0,0 +1,40 @@ +get(ManagerInterface::class); + /** @var Quote $sourceQuote */ + $sourceQuote = $objectManager->create(QuoteFactory::class)->create(); + $targetQuote = clone($sourceQuote); + $sourceQuote->setGiftMessageId($giftMessageId); + + $eventManager->dispatch( + 'sales_quote_merge_after', + [ + 'quote' => $targetQuote, + 'source' => $sourceQuote + ] + ); + + self::assertEquals($giftMessageId, $targetQuote->getGiftMessageId()); + } +} diff --git a/lib/internal/Magento/Framework/Amqp/Config.php b/lib/internal/Magento/Framework/Amqp/Config.php index 8fb827d9eb0..684c5cd38b1 100644 --- a/lib/internal/Magento/Framework/Amqp/Config.php +++ b/lib/internal/Magento/Framework/Amqp/Config.php @@ -131,10 +131,12 @@ public function __destruct() public function getValue($key) { $this->load(); - return isset($this->data[$key]) ? $this->data[$key] : null; + return $this->data[$key] ?? null; } /** + * Create amqp connection + * * @return AbstractConnection */ private function createConnection(): AbstractConnection diff --git a/lib/internal/Magento/Framework/App/Cache/State.php b/lib/internal/Magento/Framework/App/Cache/State.php index 08c1fca66ea..9d268ac2d1b 100644 --- a/lib/internal/Magento/Framework/App/Cache/State.php +++ b/lib/internal/Magento/Framework/App/Cache/State.php @@ -11,6 +11,9 @@ use Magento\Framework\App\DeploymentConfig\Writer; use Magento\Framework\Config\File\ConfigFilePool; +/** + * Cache State + */ class State implements StateInterface { /** @@ -74,7 +77,7 @@ public function __construct(DeploymentConfig $config, Writer $writer, $banAll = public function isEnabled($cacheType) { $this->load(); - return isset($this->statuses[$cacheType]) ? (bool)$this->statuses[$cacheType] : false; + return (bool)($this->statuses[$cacheType] ?? false); } /** diff --git a/lib/internal/Magento/Framework/Data/Form/Element/Editor.php b/lib/internal/Magento/Framework/Data/Form/Element/Editor.php index 39a0479f754..c438edf3aa9 100644 --- a/lib/internal/Magento/Framework/Data/Form/Element/Editor.php +++ b/lib/internal/Magento/Framework/Data/Form/Element/Editor.php @@ -50,6 +50,8 @@ public function __construct( } /** + * Returns buttons translation + * * @return array */ protected function getButtonTranslations() @@ -64,6 +66,8 @@ protected function getButtonTranslations() } /** + * Returns JS config + * * @return bool|string * @throws \InvalidArgumentException */ @@ -80,8 +84,9 @@ protected function getJsonConfig() /** * Fetch config options from plugin. If $key is passed, return only that option key's value + * * @param string $pluginName - * @param null $key + * @param string|null $key * @return mixed all options or single option if $key is passed; null if nonexistent */ public function getPluginConfigOptions($pluginName, $key = null) @@ -101,13 +106,15 @@ public function getPluginConfigOptions($pluginName, $key = null) $pluginOptions = $plugins[$pluginArrIndex]['options']; if ($key !== null) { - return isset($pluginOptions[$key]) ? $pluginOptions[$key] : null; + return $pluginOptions[$key] ?? null; } else { return $pluginOptions; } } /** + * Returns element html + * * @return string * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ @@ -200,6 +207,8 @@ public function getElementHtml() } /** + * Returns theme + * * @return mixed */ public function getTheme() @@ -343,6 +352,8 @@ protected function _checkPluginButtonOptions($pluginOptions) } /** + * Convert options + * * Convert options by replacing template constructions ( like {{var_name}} ) * with data from this element object * @@ -389,6 +400,7 @@ protected function _getButtonHtml($data) /** * Wraps Editor HTML into div if 'use_container' config option is set to true + * * If 'no_display' config option is set to true, the div will be invisible * * @param string $html HTML code to wrap @@ -463,6 +475,8 @@ public function isHidden() } /** + * Is Toggle Button Visible + * * @return bool */ protected function isToggleButtonVisible() diff --git a/lib/internal/Magento/Framework/Filter/Template/Tokenizer/Variable.php b/lib/internal/Magento/Framework/Filter/Template/Tokenizer/Variable.php index 67c2d17abe2..574ef9faf74 100644 --- a/lib/internal/Magento/Framework/Filter/Template/Tokenizer/Variable.php +++ b/lib/internal/Magento/Framework/Filter/Template/Tokenizer/Variable.php @@ -313,6 +313,6 @@ public function getNumber() if (!$this->isNumeric()) { $this->prev(); } - return floatval($value); + return (float)$value; } } diff --git a/lib/internal/Magento/Framework/GraphQl/Schema/Type/Entity/DefaultMapper.php b/lib/internal/Magento/Framework/GraphQl/Schema/Type/Entity/DefaultMapper.php index 7e3f2ac6db6..cacc1f9e28c 100644 --- a/lib/internal/Magento/Framework/GraphQl/Schema/Type/Entity/DefaultMapper.php +++ b/lib/internal/Magento/Framework/GraphQl/Schema/Type/Entity/DefaultMapper.php @@ -26,10 +26,10 @@ public function __construct(array $map = []) } /** - * {@inheritDoc} + * @inheritdoc */ public function getMappedTypes(string $entityName) : array { - return isset($this->map[$entityName]) ? $this->map[$entityName] : []; + return $this->map[$entityName] ?? []; } } diff --git a/lib/internal/Magento/Framework/GraphQl/Schema/Type/Enum/DefaultDataMapper.php b/lib/internal/Magento/Framework/GraphQl/Schema/Type/Enum/DefaultDataMapper.php index f7b39ba6420..f560fcb0de7 100644 --- a/lib/internal/Magento/Framework/GraphQl/Schema/Type/Enum/DefaultDataMapper.php +++ b/lib/internal/Magento/Framework/GraphQl/Schema/Type/Enum/DefaultDataMapper.php @@ -26,10 +26,10 @@ public function __construct(array $map) } /** - * {@inheritDoc} + * @inheritdoc */ public function getMappedEnums(string $enumName) : array { - return isset($this->map[$enumName]) ? $this->map[$enumName] : []; + return $this->map[$enumName] ?? []; } } diff --git a/lib/internal/Magento/Framework/MessageQueue/Config.php b/lib/internal/Magento/Framework/MessageQueue/Config.php index e29b5d06bee..9a925e1417c 100644 --- a/lib/internal/Magento/Framework/MessageQueue/Config.php +++ b/lib/internal/Magento/Framework/MessageQueue/Config.php @@ -30,18 +30,16 @@ public function __construct(Config\Data $queueConfigData) } /** - * {@inheritdoc} + * @inheritdoc */ public function getExchangeByTopic($topicName) { $publisherConfig = $this->getPublisherConfigByTopic($topicName); - return isset($publisherConfig[ConfigInterface::PUBLISHER_EXCHANGE]) - ? $publisherConfig[ConfigInterface::PUBLISHER_EXCHANGE] - : null; + return $publisherConfig[ConfigInterface::PUBLISHER_EXCHANGE] ?? null; } /** - * {@inheritdoc} + * @inheritdoc */ public function getQueuesByTopic($topic) { @@ -67,7 +65,7 @@ public function getQueuesByTopic($topic) } /** - * {@inheritdoc} + * @inheritdoc */ public function getConnectionByTopic($topic) { @@ -76,13 +74,11 @@ public function getConnectionByTopic($topic) } catch (\Magento\Framework\Exception\LocalizedException $e) { return null; } - return isset($publisherConfig[ConfigInterface::PUBLISHER_CONNECTION]) - ? $publisherConfig[ConfigInterface::PUBLISHER_CONNECTION] - : null; + return $publisherConfig[ConfigInterface::PUBLISHER_CONNECTION] ?? null; } /** - * {@inheritdoc} + * @inheritdoc */ public function getConnectionByConsumer($consumer) { @@ -98,7 +94,7 @@ public function getConnectionByConsumer($consumer) } /** - * {@inheritdoc} + * @inheritdoc */ public function getMessageSchemaType($topic) { @@ -109,7 +105,7 @@ public function getMessageSchemaType($topic) } /** - * {@inheritdoc} + * @inheritdoc */ public function getConsumerNames() { @@ -118,7 +114,7 @@ public function getConsumerNames() } /** - * {@inheritdoc} + * @inheritdoc */ public function getConsumer($name) { @@ -127,7 +123,7 @@ public function getConsumer($name) } /** - * {@inheritdoc} + * @inheritdoc */ public function getBinds() { @@ -135,7 +131,7 @@ public function getBinds() } /** - * {@inheritdoc} + * @inheritdoc */ public function getPublishers() { @@ -143,7 +139,7 @@ public function getPublishers() } /** - * {@inheritdoc} + * @inheritdoc */ public function getConsumers() { @@ -151,7 +147,7 @@ public function getConsumers() } /** - * {@inheritdoc} + * @inheritdoc */ public function getTopic($name) { @@ -159,7 +155,7 @@ public function getTopic($name) } /** - * {@inheritdoc} + * @inheritdoc */ public function getPublisher($name) { @@ -167,7 +163,7 @@ public function getPublisher($name) } /** - * {@inheritdoc} + * @inheritdoc */ public function getResponseQueueName($topicName) { diff --git a/lib/internal/Magento/Framework/MessageQueue/Consumer/Config/Env/Reader.php b/lib/internal/Magento/Framework/MessageQueue/Consumer/Config/Env/Reader.php index aa318ba5f19..a75aa1ea8ea 100644 --- a/lib/internal/Magento/Framework/MessageQueue/Consumer/Config/Env/Reader.php +++ b/lib/internal/Magento/Framework/MessageQueue/Consumer/Config/Env/Reader.php @@ -33,8 +33,6 @@ public function __construct(\Magento\Framework\MessageQueue\Config\Reader\Env $e public function read($scope = null) { $configData = $this->envConfig->read($scope); - return isset($configData[\Magento\Framework\MessageQueue\Config\Reader\Env::ENV_CONSUMERS]) - ? $configData[\Magento\Framework\MessageQueue\Config\Reader\Env::ENV_CONSUMERS] - : []; + return $configData[\Magento\Framework\MessageQueue\Config\Reader\Env::ENV_CONSUMERS] ?? []; } } diff --git a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Factories/Real.php b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Factories/Real.php index cdb740ea0a9..e0728b9a34f 100644 --- a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Factories/Real.php +++ b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Factories/Real.php @@ -39,7 +39,7 @@ class Real implements FactoryInterface * Constructor. * * @param ObjectManagerInterface $objectManager - * @param string $className + * @param string $className */ public function __construct( ObjectManagerInterface $objectManager, @@ -50,7 +50,7 @@ public function __construct( } /** - * {@inheritdoc} + * @inheritdoc */ public function create(array $data) { @@ -63,7 +63,7 @@ public function create(array $data) } if (isset($data['default'])) { - $data['default'] = floatval($data['default']); + $data['default'] = (float)$data['default']; } return $this->objectManager->create($this->className, $data); diff --git a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Schema.php b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Schema.php index 3e68b985283..fbbe188d127 100644 --- a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Schema.php +++ b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Schema.php @@ -63,14 +63,15 @@ public function addTable(Table $table) /** * Retrieve table by it name. + * * Return false if table is not present in schema. * - * @param $name + * @param string $name * @return bool|Table */ public function getTableByName($name) { $name = $this->resourceConnection->getTableName($name); - return isset($this->tables[$name]) ? $this->tables[$name] : false; + return $this->tables[$name] ?? false; } } diff --git a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Table.php b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Table.php index 4f020b1a032..b4e1e978ea6 100644 --- a/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Table.php +++ b/lib/internal/Magento/Framework/Setup/Declaration/Schema/Dto/Table.php @@ -87,11 +87,11 @@ class Table extends GenericElement implements * @param string $engine * @param string $charset * @param string $collation + * @param string $onCreate * @param string|null $comment * @param array $columns * @param array $indexes * @param array $constraints - * @param string $onCreate * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -123,6 +123,7 @@ public function __construct( /** * Return different table constraints. + * * It can be constraint like unique key or reference to another table, etc * * @return Constraint[] @@ -133,12 +134,14 @@ public function getConstraints() } /** + * Returns constraint by name + * * @param string $name * @return Constraint | bool */ public function getConstraintByName($name) { - return isset($this->constraints[$name]) ? $this->constraints[$name] : false; + return $this->constraints[$name] ?? false; } /** @@ -160,6 +163,8 @@ public function getReferenceConstraints() } /** + * Returns primary constraint + * * As primary constraint always have one name * and can be only one for table * it name is allocated into it constraint @@ -168,9 +173,7 @@ public function getReferenceConstraints() */ public function getPrimaryConstraint() { - return isset($this->constraints[Internal::PRIMARY_NAME]) ? - $this->constraints[Internal::PRIMARY_NAME] : - false; + return $this->constraints[Internal::PRIMARY_NAME] ?? false; } /** @@ -191,16 +194,19 @@ public function getInternalConstraints() : array } /** + * Returns index by name + * * @param string $name * @return Index | bool */ public function getIndexByName($name) { - return isset($this->indexes[$name]) ? $this->indexes[$name] : false; + return $this->indexes[$name] ?? false; } /** * Return all columns. + * * Note, table always must have columns * * @return Column[] @@ -231,6 +237,8 @@ public function getResource() } /** + * Add constraints + * * This is workaround, as any DTO object couldnt be changed after instantiation. * However there is case, when we have 2 tables with constraints in different tables, * that depends to each other table. So we need to setup DTO first and only then pass @@ -280,6 +288,7 @@ public function getColumnByName($nameOrId) /** * Retrieve elements by specific type + * * Allowed types: columns, constraints, indexes... * * @param string $type @@ -295,6 +304,8 @@ public function getElementsByType($type) } /** + * Add indexes + * * This is workaround, as any DTO object couldnt be changed after instantiation. * However there is case, when we depends on column definition we need modify our indexes * @@ -314,6 +325,8 @@ public function getElementType() } /** + * Returns engine name + * * @return string */ public function getEngine(): string @@ -356,6 +369,8 @@ public function getCollation() : string } /** + * Returns name without prefix + * * @return string */ public function getNameWithoutPrefix(): string @@ -364,6 +379,8 @@ public function getNameWithoutPrefix(): string } /** + * Returns comment + * * @return null|string */ public function getComment()