Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring in Magento_SalesRule #19929

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/
namespace Magento\SalesRule\Controller\Adminhtml\Promo\Quote;

use Magento\Framework\App\ObjectManager;
use Magento\SalesRule\Model\CouponGenerator;

class Generate extends \Magento\SalesRule\Controller\Adminhtml\Promo\Quote
Expand Down
5 changes: 2 additions & 3 deletions app/code/Magento/SalesRule/Model/CouponRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

use Magento\Framework\Api\Search\FilterGroup;
use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface;
use Magento\Framework\Api\SortOrder;
use Magento\SalesRule\Model\ResourceModel\Coupon\Collection;

/**
Expand Down Expand Up @@ -197,13 +196,13 @@ public function deleteById($couponId)
/**
* Helper function that adds a FilterGroup to the collection.
*
* @param \Magento\Framework\Api\Search\FilterGroup $filterGroup
* @param FilterGroup $filterGroup
* @param Collection $collection
* @deprecated 100.2.0
* @return void
*/
protected function addFilterGroupToCollection(
\Magento\Framework\Api\Search\FilterGroup $filterGroup,
FilterGroup $filterGroup,
Collection $collection
) {
$fields = [];
Expand Down
3 changes: 1 addition & 2 deletions app/code/Magento/SalesRule/Model/Data/Rule.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
* @SuppressWarnings(PHPMD.ExcessivePublicCount)
* @codeCoverageIgnore
*/
class Rule extends \Magento\Framework\Api\AbstractExtensibleObject implements
\Magento\SalesRule\Api\Data\RuleInterface
class Rule extends \Magento\Framework\Api\AbstractExtensibleObject implements RuleInterface
{
const KEY_RULE_ID = 'rule_id';
const KEY_NAME = 'name';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
*/
namespace Magento\SalesRule\Model\Plugin;

use Magento\Store\Model\StoreManagerInterface;
use Magento\Customer\Model\Session;
use Magento\SalesRule\Model\ResourceModel\Rule as RuleResource;

class QuoteConfigProductAttributes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/
namespace Magento\SalesRule\Model\ResourceModel;

use Magento\SalesRule\Model\ResourceModel\Rule;
use Magento\Framework\EntityManager\MetadataPool;
use Magento\Framework\EntityManager\Operation\AttributeInterface;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/
namespace Magento\SalesRule\Model\ResourceModel;

use Magento\SalesRule\Model\ResourceModel\Rule;
use Magento\Framework\EntityManager\MetadataPool;
use Magento\Framework\EntityManager\Operation\AttributeInterface;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/
namespace Magento\SalesRule\Model\Rule\Action\Discount;

use Magento\Framework\App\ObjectManager;
use Magento\Framework\Pricing\PriceCurrencyInterface;
use Magento\SalesRule\Model\DeltaPriceRound;
use Magento\SalesRule\Model\Validator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/
namespace Magento\SalesRule\Model\Rule\Metadata;

use Magento\SalesRule\Model\ResourceModel\Rule\Collection;
use Magento\SalesRule\Model\Rule;
use Magento\Store\Model\System\Store;
use Magento\Customer\Api\GroupRepositoryInterface;
Expand Down
5 changes: 2 additions & 3 deletions app/code/Magento/SalesRule/Model/RuleRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use Magento\Framework\Api\Search\FilterGroup;
use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface;
use Magento\Framework\Api\SearchCriteriaInterface;
use Magento\Framework\Api\SortOrder;
use Magento\SalesRule\Model\ResourceModel\Rule\Collection;

/**
Expand Down Expand Up @@ -183,13 +182,13 @@ public function deleteById($id)
/**
* Helper function that adds a FilterGroup to the collection.
*
* @param \Magento\Framework\Api\Search\FilterGroup $filterGroup
* @param FilterGroup $filterGroup
* @param Collection $collection
* @deprecated 100.2.0
* @return void
*/
protected function addFilterGroupToCollection(
\Magento\Framework\Api\Search\FilterGroup $filterGroup,
FilterGroup $filterGroup,
Collection $collection
) {
$fields = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

namespace Magento\SalesRule\Setup\Patch\Data;

use Magento\Framework\App\ResourceConnection;
use Magento\Framework\Setup\Patch\DataPatchInterface;
use Magento\Framework\Setup\Patch\PatchVersionInterface;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

namespace Magento\SalesRule\Setup\Patch\Data;

use Magento\Framework\App\ResourceConnection;
use Magento\Framework\App\State;
use Magento\Framework\Setup\Patch\DataPatchInterface;
use Magento\Framework\Setup\Patch\PatchVersionInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
namespace Magento\SalesRule\Setup\Patch\Data;

use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Framework\App\ResourceConnection;
use Magento\Framework\Setup\Patch\DataPatchInterface;
use Magento\Framework\Setup\Patch\PatchVersionInterface;

Expand All @@ -18,16 +17,16 @@
class PrepareRuleModelSerializedData implements DataPatchInterface, PatchVersionInterface
{
/**
* @var \Magento\Framework\Setup\ModuleDataSetupInterface
* @var ModuleDataSetupInterface
*/
private $moduleDataSetup;

/**
* PatchInitial constructor.
* @param \Magento\Framework\Setup\ModuleDataSetupInterface $moduleDataSetup
* @param ModuleDataSetupInterface $moduleDataSetup
*/
public function __construct(
\Magento\Framework\Setup\ModuleDataSetupInterface $moduleDataSetup
ModuleDataSetupInterface $moduleDataSetup
) {
$this->moduleDataSetup = $moduleDataSetup;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*/
namespace Magento\SalesRule\Test\Unit\Block\Adminhtml\Promo\Quote\Edit;

use Magento\SalesRule\Model\RegistryConstants;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;

class DeleteButtonTest extends \PHPUnit\Framework\TestCase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
class ReadHandlerTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\SalesRule\Model\ResourceModel\ReadHandler
* @var ReadHandler
*/
protected $model;

Expand Down Expand Up @@ -49,7 +49,7 @@ protected function setUp()
$this->metadataPool = $this->createMock($className);

$this->model = $this->objectManager->getObject(
\Magento\SalesRule\Model\ResourceModel\ReadHandler::class,
ReadHandler::class,
[
'ruleResource' => $this->ruleResource,
'metadataPool' => $this->metadataPool,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
class DateApplierTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\SalesRule\Model\ResourceModel\Rule\DateApplier|\PHPUnit_Framework_MockObject_MockObject
* @var DateApplier|\PHPUnit_Framework_MockObject_MockObject
*/
protected $model;

Expand All @@ -29,10 +29,7 @@ protected function setUp()
{
$this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);

$this->model = $this->objectManager->getObject(
\Magento\SalesRule\Model\ResourceModel\Rule\DateApplier::class,
[]
);
$this->model = $this->objectManager->getObject(DateApplier::class, []);
}

/**
Expand Down