Skip to content

Commit

Permalink
Merge pull request #519 from magento-performance/ACPT-1219
Browse files Browse the repository at this point in the history
ACPT-1219: Fix Static Tests failures for application-Server PR
  • Loading branch information
andimov committed Apr 20, 2023
2 parents 3d5d091 + a839db8 commit 119f6d0
Show file tree
Hide file tree
Showing 53 changed files with 186 additions and 158 deletions.
7 changes: 5 additions & 2 deletions app/code/Magento/Bundle/Pricing/Adjustment/Calculator.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@ protected function getSelectionAmounts(Product $bundleProduct, $searchMin, $useR
* @param Option $option
* @param bool $canSkipRequiredOption
* @return bool
* @deprecated 100.2.0
* @deprecated 100.2.0 Not used anymore.
* @see Nothing
*/
protected function canSkipOption($option, $canSkipRequiredOption)
{
Expand All @@ -227,7 +228,8 @@ protected function canSkipOption($option, $canSkipRequiredOption)
*
* @param Product $bundleProduct
* @return bool
* @deprecated 100.2.0
* @deprecated 100.2.0 Not used anymore.
* @see Nothing
*/
protected function hasRequiredOption($bundleProduct)
{
Expand All @@ -246,6 +248,7 @@ function ($item) {
* @param Product $saleableItem
* @return \Magento\Bundle\Model\ResourceModel\Option\Collection
* @deprecated 100.2.0
* @see Nothing
*/
protected function getBundleOptions(Product $saleableItem)
{
Expand Down
1 change: 1 addition & 0 deletions app/code/Magento/Bundle/Pricing/Price/BundleOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ public function calculateOptions(
/** @var \Magento\Bundle\Pricing\Price\BundleSelectionPrice $selectionPriceList */
$selectionPriceList = $this->calculator->createSelectionPriceList($option, $bundleProduct);
$selectionPriceList = $this->calculator->processOptions($option, $selectionPriceList, $searchMin);
// phpcs:ignore Magento2.Performance.ForeachArrayMerge
$priceList = array_merge($priceList, $selectionPriceList);
}
$amount = $this->calculator->calculateBundleAmount(0., $bundleProduct, $priceList);
Expand Down
3 changes: 2 additions & 1 deletion app/code/Magento/Bundle/Pricing/Price/BundleRegularPrice.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
namespace Magento\Bundle\Pricing\Price;

use Magento\Bundle\Pricing\Adjustment\BundleCalculatorInterface;
use Magento\Catalog\Pricing\Price\RegularPrice;
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
use Magento\Framework\Pricing\Amount\AmountInterface;
use Magento\Catalog\Pricing\Price\CustomOptionPrice;
Expand All @@ -15,7 +16,7 @@
/**
* Bundle product regular price model
*/
class BundleRegularPrice extends \Magento\Catalog\Pricing\Price\RegularPrice implements RegularPriceInterface, ResetAfterRequestInterface
class BundleRegularPrice extends RegularPrice implements RegularPriceInterface, ResetAfterRequestInterface
{
/**
* @var BundleCalculatorInterface
Expand Down
2 changes: 0 additions & 2 deletions app/code/Magento/BundleGraphQl/Model/Resolver/BundleItems.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ public function __construct(
}

/**
* Fetch and format bundle option items.
*
* @inheritDoc
*/
public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class Bundle extends \Magento\CatalogImportExport\Model\Import\Product\Type\AbstractType
implements ResetAfterRequestInterface
class Bundle extends \Magento\CatalogImportExport\Model\Import\Product\Type\AbstractType implements
ResetAfterRequestInterface
{
/**
* Delimiter before product option value.
Expand Down Expand Up @@ -796,6 +796,4 @@ public function _resetState(): void
$this->_cachedOptionSelectQuery = [];
$this->_cachedSkuToProducts = [];
}


}
8 changes: 4 additions & 4 deletions app/code/Magento/Catalog/Helper/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
*/
class Category extends AbstractHelper implements ResetAfterRequestInterface
{
const XML_PATH_USE_CATEGORY_CANONICAL_TAG = 'catalog/seo/category_canonical_tag';
public const XML_PATH_USE_CATEGORY_CANONICAL_TAG = 'catalog/seo/category_canonical_tag';

const XML_PATH_CATEGORY_ROOT_ID = 'catalog/category/root_id';
public const XML_PATH_CATEGORY_ROOT_ID = 'catalog/category/root_id';

/**
* Store categories cache
Expand All @@ -31,14 +31,14 @@ class Category extends AbstractHelper implements ResetAfterRequestInterface
protected $_storeCategories = [];

/**
* Store manager
* Store manager instance
*
* @var \Magento\Store\Model\StoreManagerInterface
*/
protected $_storeManager;

/**
* Category factory
* Category factory instance
*
* @var \Magento\Catalog\Model\CategoryFactory
*/
Expand Down
8 changes: 4 additions & 4 deletions app/code/Magento/Catalog/Model/Layer/FilterList.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
*/
class FilterList implements ResetAfterRequestInterface
{
const CATEGORY_FILTER = 'category';
const ATTRIBUTE_FILTER = 'attribute';
const PRICE_FILTER = 'price';
const DECIMAL_FILTER = 'decimal';
public const CATEGORY_FILTER = 'category';
public const ATTRIBUTE_FILTER = 'attribute';
public const PRICE_FILTER = 'price';
public const DECIMAL_FILTER = 'decimal';

/**
* Filter factory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
namespace Magento\CatalogGraphQl\Model\Resolver\Product;

use Magento\CatalogGraphQl\Model\PriceRangeDataProvider;
use Magento\CatalogGraphQl\Model\Resolver\Product\Price\Discount;
use Magento\CatalogGraphQl\Model\Resolver\Product\Price\ProviderPool as PriceProviderPool;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\GraphQl\Query\ResolverInterface;
use Magento\Framework\GraphQl\Config\Element\Field;
Expand All @@ -26,13 +24,9 @@ class PriceRange implements ResolverInterface
private PriceRangeDataProvider $priceRangeDataProvider;

/**
* @param PriceProviderPool $priceProviderPool Deprecated. @use $priceRangeDataProvider
* @param Discount $discount Deprecated. @use $priceRangeDataProvider
* @param PriceRangeDataProvider|null $priceRangeDataProvider
*/
public function __construct(
PriceProviderPool $priceProviderPool,
Discount $discount,
PriceRangeDataProvider $priceRangeDataProvider = null
) {
$this->priceRangeDataProvider = $priceRangeDataProvider
Expand Down
21 changes: 18 additions & 3 deletions app/code/Magento/CatalogInventory/Model/StockRegistryStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
use Magento\CatalogInventory\Api\Data\StockStatusInterface;
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;

/**
* Class StockRegistryStorage
*/
class StockRegistryStorage implements ResetAfterRequestInterface
{
/**
Expand All @@ -31,6 +28,8 @@ class StockRegistryStorage implements ResetAfterRequestInterface
private $stockStatuses = [];

/**
* Get Stock Data
*
* @param int $scopeId
* @return StockInterface
*/
Expand All @@ -40,6 +39,8 @@ public function getStock($scopeId)
}

/**
* Set Stock cache
*
* @param int $scopeId
* @param StockInterface $value
* @return void
Expand All @@ -50,6 +51,8 @@ public function setStock($scopeId, StockInterface $value)
}

/**
* Delete cached Stock based on scopeId
*
* @param int|null $scopeId
* @return void
*/
Expand All @@ -63,6 +66,8 @@ public function removeStock($scopeId = null)
}

/**
* Retrieve Stock Item
*
* @param int $productId
* @param int $scopeId
* @return StockItemInterface
Expand All @@ -73,6 +78,8 @@ public function getStockItem($productId, $scopeId)
}

/**
* Update Stock Item
*
* @param int $productId
* @param int $scopeId
* @param StockItemInterface $value
Expand All @@ -84,6 +91,8 @@ public function setStockItem($productId, $scopeId, StockItemInterface $value)
}

/**
* Remove stock Item based on productId & scopeId
*
* @param int $productId
* @param int|null $scopeId
* @return void
Expand All @@ -98,6 +107,8 @@ public function removeStockItem($productId, $scopeId = null)
}

/**
* Retrieve stock status
*
* @param int $productId
* @param int $scopeId
* @return StockStatusInterface
Expand All @@ -108,6 +119,8 @@ public function getStockStatus($productId, $scopeId)
}

/**
* Update stock Status
*
* @param int $productId
* @param int $scopeId
* @param StockStatusInterface $value
Expand All @@ -119,6 +132,8 @@ public function setStockStatus($productId, $scopeId, StockStatusInterface $value
}

/**
* Clear stock status
*
* @param int $productId
* @param int|null $scopeId
* @return void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ValueProcessor
/**
* Placeholder for the output of sensitive data.
*/
const SAFE_PLACEHOLDER = '******';
public const SAFE_PLACEHOLDER = '******';

/**
* System configuration structure factory.
Expand Down
6 changes: 2 additions & 4 deletions app/code/Magento/Customer/Model/CustomerRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*/
class CustomerRegistry implements ResetAfterRequestInterface
{
const REGISTRY_SEPARATOR = ':';
public const REGISTRY_SEPARATOR = ':';

/**
* @var CustomerFactory
Expand Down Expand Up @@ -117,9 +117,7 @@ public function retrieveByEmail($customerEmail, $websiteId = null)
/** @var Customer $customer */
$customer = $this->customerFactory->create();

if (isset($websiteId)) {
$customer->setWebsiteId($websiteId);
}
$customer->setWebsiteId($websiteId);

$customer->loadByEmail($customerEmail);
if (!$customer->getEmail()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class AttributeMetadataCache implements ResetAfterRequestInterface
/**
* Cache prefix
*/
const ATTRIBUTE_METADATA_CACHE_PREFIX = 'ATTRIBUTE_METADATA_INSTANCES_CACHE';
public const ATTRIBUTE_METADATA_CACHE_PREFIX = 'ATTRIBUTE_METADATA_INSTANCES_CACHE';

/**
* @var CacheInterface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
namespace Magento\Eav\Model\Entity\VersionControl;

use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
use Magento\Framework\Model\ResourceModel\Db\VersionControl\Metadata as ResourceModelMetaData;

/**
* Class Metadata represents a list of entity fields that are applicable for persistence operations
*/
class Metadata extends \Magento\Framework\Model\ResourceModel\Db\VersionControl\Metadata implements ResetAfterRequestInterface
class Metadata extends ResourceModelMetaData implements ResetAfterRequestInterface
{
/**
* Returns list of entity fields that are applicable for persistence operations
Expand Down
6 changes: 2 additions & 4 deletions app/code/Magento/GiftMessage/Model/OrderItemRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
class OrderItemRepository implements \Magento\GiftMessage\Api\OrderItemRepositoryInterface, ResetAfterRequestInterface
{
/**
* Order factory.
* Factory for Order instances.
*
* @var \Magento\Sales\Model\OrderFactory
*/
Expand All @@ -39,7 +39,7 @@ class OrderItemRepository implements \Magento\GiftMessage\Api\OrderItemRepositor
protected $storeManager;

/**
* Gift message save model.
* Model for Gift message save.
*
* @var \Magento\GiftMessage\Model\Save
*/
Expand All @@ -53,8 +53,6 @@ class OrderItemRepository implements \Magento\GiftMessage\Api\OrderItemRepositor
protected $helper;

/**
* Message factory.
*
* @var \Magento\GiftMessage\Model\MessageFactory
*/
protected $messageFactory;
Expand Down
3 changes: 3 additions & 0 deletions app/code/Magento/GraphQl/Model/Query/ContextFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ public function get(): ContextInterface
return $this->context;
}

/**
* @inheritDoc
*/
public function _resetState(): void
{
$this->context = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
*/
class IndexerSetDimensionsModeCommand extends AbstractIndexerCommand
{
const INPUT_KEY_MODE = 'mode';
const INPUT_KEY_INDEXER = 'indexer';
const DIMENSION_MODE_NONE = 'none';
const XML_PATH_DIMENSIONS_MODE_MASK = 'indexer/%s/dimensions_mode';
public const INPUT_KEY_MODE = 'mode';
public const INPUT_KEY_INDEXER = 'indexer';
public const DIMENSION_MODE_NONE = 'none';
public const XML_PATH_DIMENSIONS_MODE_MASK = 'indexer/%s/dimensions_mode';

/**
* @var string
Expand Down Expand Up @@ -59,7 +59,7 @@ public function __construct(
}

/**
* {@inheritdoc}
* @inheritdoc
*/
protected function configure()
{
Expand All @@ -70,7 +70,7 @@ protected function configure()
}

/**
* {@inheritdoc}
* @inheritdoc
* @param InputInterface $input
* @param OutputInterface $output
* @return int
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,27 @@ class ModeInputArgument extends InputArgument
private $callableDescription;

/**
*
* @param string $name
* @param int|null $mode
* @param callable|null $callableDescription
* @param $default
* @param string|bool|int|float|array|null $default
*/
public function __construct(string $name, int $mode = null, callable $callableDescription = null, $default = null)
{
$this->callableDescription = $callableDescription;
parent::__construct($name, $mode, '', $default);
}

/**
* @inheritDoc
*/
public function getDescription()
{
if (null !== $this->callableDescription) {
$this->description = ($this->callableDescription)();
$description = ($this->callableDescription)();
$this->callableDescription = null;
return $description;
}
return parent::getDescription();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class CouponCodeValidationTest extends TestCase
/**
* @var MockObject&SearchCriteriaBuilderFactory
*/
private $searchCriteriaBuilderFactoryMock;
private $searchCriteriaBuilderMockFactory;

/**
* @var MockObject&Observer
Expand Down
Loading

0 comments on commit 119f6d0

Please sign in to comment.