-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
23 changed files
with
367 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Rector\Config\RectorConfig; | ||
use Sylius\SyliusRector\Rector\Class_\AddInterfaceToClassExtendingTypeRector; | ||
use Sylius\SyliusRector\Rector\Class_\AddTraitToClassExtendingTypeRector; | ||
|
||
return static function (RectorConfig $rectorConfig): void { | ||
$rectorConfig->ruleWithConfiguration(AddInterfaceToClassExtendingTypeRector::class, [ | ||
'Sylius\Component\Core\Model\Address' => [ | ||
'Sylius\B2BKit\Entity\AddressInterface', | ||
], | ||
'Sylius\Component\Core\Model\Customer' => [ | ||
'Sylius\B2BKit\Entity\CustomerInterface', | ||
], | ||
'Sylius\Component\Customer\Model\CustomerGroup' => [ | ||
'Sylius\B2BKit\Entity\CustomerGroupInterface', | ||
], | ||
'Sylius\Component\Core\Model\Order' => [ | ||
'Sylius\B2BKit\Entity\OrderInterface', | ||
], | ||
'Sylius\Component\Core\Model\ShopUser' => [ | ||
'Sylius\B2BKit\Entity\ShopUserInterface', | ||
], | ||
]); | ||
$rectorConfig->ruleWithConfiguration(AddTraitToClassExtendingTypeRector::class, [ | ||
'Sylius\Component\Core\Model\Address' => [ | ||
'Sylius\B2BKit\Entity\AddressAwareTrait', | ||
], | ||
'Sylius\Component\Core\Model\Customer' => [ | ||
'Sylius\B2BKit\Entity\CustomerAwareTrait', | ||
], | ||
'Sylius\Component\Customer\Model\CustomerGroup' => [ | ||
'Sylius\B2BKit\Entity\CustomerGroupAwareTrait', | ||
], | ||
'Sylius\Component\Core\Model\Order' => [ | ||
'Sylius\B2BKit\Entity\OrderAwareTrait', | ||
], | ||
'Sylius\Component\Core\Model\ShopUser' => [ | ||
'Sylius\B2BKit\Entity\ShopUserAwareTrait', | ||
], | ||
]); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Sylius\B2BKit\Entity; | ||
|
||
if (trait_exists('Sylius\B2BKit\Entity\AddressAwareTrait')) { | ||
return; | ||
} | ||
|
||
trait AddressAwareTrait | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Sylius\B2BKit\Entity; | ||
|
||
if (class_exists('Sylius\B2BKit\Entity\AddressInterface')) { | ||
return; | ||
} | ||
|
||
interface AddressInterface | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Sylius\B2BKit\Entity; | ||
|
||
if (trait_exists('Sylius\B2BKit\Entity\CustomerAwareTrait')) { | ||
return; | ||
} | ||
|
||
trait CustomerAwareTrait | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Sylius\B2BKit\Entity; | ||
|
||
if (trait_exists('Sylius\B2BKit\Entity\CustomerGroupAwareTrait')) { | ||
return; | ||
} | ||
|
||
trait CustomerGroupAwareTrait | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Sylius\B2BKit\Entity; | ||
|
||
if (class_exists('Sylius\B2BKit\Entity\CustomerGroupInterface')) { | ||
return; | ||
} | ||
|
||
interface CustomerGroupInterface | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Sylius\B2BKit\Entity; | ||
|
||
if (class_exists('Sylius\B2BKit\Entity\CustomerInterface')) { | ||
return; | ||
} | ||
|
||
interface CustomerInterface | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Sylius\B2BKit\Entity; | ||
|
||
if (trait_exists('Sylius\B2BKit\Entity\OrderAwareTrait')) { | ||
return; | ||
} | ||
|
||
trait OrderAwareTrait | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Sylius\B2BKit\Entity; | ||
|
||
if (class_exists('Sylius\B2BKit\Entity\OrderInterface')) { | ||
return; | ||
} | ||
|
||
interface OrderInterface | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Sylius\B2BKit\Entity; | ||
|
||
if (trait_exists('Sylius\B2BKit\Entity\ShopUserAwareTrait')) { | ||
return; | ||
} | ||
|
||
trait ShopUserAwareTrait | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Sylius\B2BKit\Entity; | ||
|
||
if (class_exists('Sylius\B2BKit\Entity\ShopUserInterface')) { | ||
return; | ||
} | ||
|
||
interface ShopUserInterface | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace Sylius\Component\Core\Model; | ||
|
||
if (class_exists('Sylius\Component\Core\Model\Address')) { | ||
return; | ||
} | ||
|
||
class Address | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace Sylius\Component\Core\Model; | ||
|
||
if (class_exists('Sylius\Component\Core\Model\ShopUser')) { | ||
return; | ||
} | ||
|
||
class ShopUser | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace Sylius\Component\Customer\Model; | ||
|
||
if (class_exists('Sylius\Component\Customer\Model\CustomerGroup')) { | ||
return; | ||
} | ||
|
||
class CustomerGroup | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Sylius\SyliusRector\Tests\Set\SyliusPlus\B2BKit; | ||
|
||
use Rector\Testing\PHPUnit\AbstractRectorTestCase; | ||
|
||
final class B2BSuiteTest extends AbstractRectorTestCase | ||
{ | ||
/** @dataProvider provideData() */ | ||
public function test(string $file): void | ||
{ | ||
$this->doTestFile($file); | ||
} | ||
|
||
/** @return \Iterator<string> */ | ||
public function provideData(): \Iterator | ||
{ | ||
return self::yieldFilesFromDirectory(__DIR__ . '/Fixture'); | ||
} | ||
|
||
public function provideConfigFilePath(): string | ||
{ | ||
return __DIR__ . '/config/configured_rule.php'; | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
tests/Set/SyliusPlus/B2BSuite/Fixture/class_extending_core_address_model.php.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace Sylius\SyliusRector\Tests\Rector\Class_\AddInterfaceToClassExtendingType\Fixture; | ||
|
||
use Sylius\Component\Core\Model\Address as BaseAddress; | ||
|
||
class Address extends BaseAddress | ||
{ | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Sylius\SyliusRector\Tests\Rector\Class_\AddInterfaceToClassExtendingType\Fixture; | ||
|
||
use Sylius\Component\Core\Model\Address as BaseAddress; | ||
|
||
class Address extends BaseAddress implements \Sylius\B2BKit\Entity\AddressInterface | ||
{ | ||
use \Sylius\B2BKit\Entity\AddressAwareTrait; | ||
} | ||
|
||
?> |
24 changes: 24 additions & 0 deletions
24
tests/Set/SyliusPlus/B2BSuite/Fixture/class_extending_core_customer_group_model.php.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace Sylius\SyliusRector\Tests\Rector\Class_\AddInterfaceToClassExtendingType\Fixture; | ||
|
||
use Sylius\Component\Customer\Model\CustomerGroup as BaseCustomerGroup; | ||
|
||
class CustomerGroup extends BaseCustomerGroup | ||
{ | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Sylius\SyliusRector\Tests\Rector\Class_\AddInterfaceToClassExtendingType\Fixture; | ||
|
||
use Sylius\Component\Customer\Model\CustomerGroup as BaseCustomerGroup; | ||
|
||
class CustomerGroup extends BaseCustomerGroup implements \Sylius\B2BKit\Entity\CustomerGroupInterface | ||
{ | ||
use \Sylius\B2BKit\Entity\CustomerGroupAwareTrait; | ||
} | ||
|
||
?> |
24 changes: 24 additions & 0 deletions
24
tests/Set/SyliusPlus/B2BSuite/Fixture/class_extending_core_customer_model.php.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace Sylius\SyliusRector\Tests\Rector\Class_\AddInterfaceToClassExtendingType\Fixture; | ||
|
||
use Sylius\Component\Core\Model\Customer as BaseCustomer; | ||
|
||
class Customer extends BaseCustomer | ||
{ | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Sylius\SyliusRector\Tests\Rector\Class_\AddInterfaceToClassExtendingType\Fixture; | ||
|
||
use Sylius\Component\Core\Model\Customer as BaseCustomer; | ||
|
||
class Customer extends BaseCustomer implements \Sylius\B2BKit\Entity\CustomerInterface | ||
{ | ||
use \Sylius\B2BKit\Entity\CustomerAwareTrait; | ||
} | ||
|
||
?> |
24 changes: 24 additions & 0 deletions
24
tests/Set/SyliusPlus/B2BSuite/Fixture/class_extending_core_order_model.php.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace Sylius\SyliusRector\Tests\Rector\Class_\AddInterfaceToClassExtendingType\Fixture; | ||
|
||
use Sylius\Component\Core\Model\Order as BaseOrder; | ||
|
||
class Order extends BaseOrder | ||
{ | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Sylius\SyliusRector\Tests\Rector\Class_\AddInterfaceToClassExtendingType\Fixture; | ||
|
||
use Sylius\Component\Core\Model\Order as BaseOrder; | ||
|
||
class Order extends BaseOrder implements \Sylius\B2BKit\Entity\OrderInterface | ||
{ | ||
use \Sylius\B2BKit\Entity\OrderAwareTrait; | ||
} | ||
|
||
?> |
24 changes: 24 additions & 0 deletions
24
tests/Set/SyliusPlus/B2BSuite/Fixture/class_extending_core_shop_user_model.php.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace Sylius\SyliusRector\Tests\Rector\Class_\AddInterfaceToClassExtendingType\Fixture; | ||
|
||
use Sylius\Component\Core\Model\ShopUser as BaseShopUser; | ||
|
||
class ShopUser extends BaseShopUser | ||
{ | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Sylius\SyliusRector\Tests\Rector\Class_\AddInterfaceToClassExtendingType\Fixture; | ||
|
||
use Sylius\Component\Core\Model\ShopUser as BaseShopUser; | ||
|
||
class ShopUser extends BaseShopUser implements \Sylius\B2BKit\Entity\ShopUserInterface | ||
{ | ||
use \Sylius\B2BKit\Entity\ShopUserAwareTrait; | ||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Rector\Config\RectorConfig; | ||
use Sylius\SyliusRector\Set\SyliusPlus; | ||
|
||
return static function (RectorConfig $rectorConfig): void { | ||
$rectorConfig->import(__DIR__ . '/../../../../../config/config.php'); | ||
$rectorConfig->sets([SyliusPlus::B2B_SUITE]); | ||
}; |
Oops, something went wrong.