-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3edd808
commit af3acb8
Showing
9 changed files
with
155 additions
and
2 deletions.
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
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 Sulu\Rector\Set\SuluLevelSetList; | ||
use Sulu\Rector\Set\SuluSetList; | ||
|
||
return static function (RectorConfig $rectorConfig): void { | ||
$rectorConfig->sets([SuluSetList::SULU_30, SuluLevelSetList::UP_TO_SULU_25]); | ||
}; |
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,43 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use PHPStan\Type\ArrayType; | ||
use PHPStan\Type\BooleanType; | ||
use PHPStan\Type\FloatType; | ||
use PHPStan\Type\IntegerType; | ||
use PHPStan\Type\IterableType; | ||
use PHPStan\Type\MixedType; | ||
use PHPStan\Type\ObjectType; | ||
use PHPStan\Type\StringType; | ||
use Rector\Config\RectorConfig; | ||
use Rector\Renaming\Rector\MethodCall\RenameMethodRector; | ||
use Rector\Renaming\ValueObject\MethodCallRename; | ||
use Rector\TypeDeclaration\Rector\ClassMethod\AddReturnTypeDeclarationRector; | ||
use Rector\TypeDeclaration\ValueObject\AddReturnTypeDeclaration; | ||
|
||
return static function (RectorConfig $rectorConfig): void { | ||
$rectorConfig->ruleWithConfiguration( | ||
RenameMethodRector::class, | ||
[ | ||
// @see https://github.com/sulu/sulu/pull/7053 | ||
new MethodCallRename( | ||
'Sulu\Component\Webspace\Portal', | ||
'getXDefaultLocalization', | ||
'getDefaultLocalization', | ||
), | ||
// @see https://github.com/sulu/sulu/pull/7053 | ||
new MethodCallRename( | ||
'Sulu\Component\Webspace\Portal', | ||
'setXDefaultLocalization', | ||
'setDefaultLocalization', | ||
), | ||
// @see https://github.com/sulu/sulu/pull/7053 | ||
new MethodCallRename( | ||
'Sulu\Component\Localization\Localization', | ||
'isXDefault', | ||
'isDefault', | ||
), | ||
], | ||
); | ||
}; |
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
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
45 changes: 45 additions & 0 deletions
45
tests/Set/Sulu30/Fixture/portal_localization_xdefault_to_default.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,45 @@ | ||
<?php | ||
|
||
namespace Sulu\Rector\Tests\Set\Sulu30\Fixture; | ||
|
||
class PortalLocalizationXDefaultToDefault { | ||
public function getDefaultLocalization(\Sulu\Component\Webspace\Portal $portal): string | ||
{ | ||
return $portal->getXDefaultLocalization(); | ||
} | ||
|
||
public function setDefaultLocalization(\Sulu\Component\Webspace\Portal $portal, \Sulu\Component\Localization\Localization $localization): void | ||
{ | ||
$portal->setXDefaultLocalization($localization); | ||
} | ||
|
||
public function isDefault(\Sulu\Component\Localization\Localization $localization): string | ||
{ | ||
return $localization->isXDefault(); | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Sulu\Rector\Tests\Set\Sulu30\Fixture; | ||
|
||
class PortalLocalizationXDefaultToDefault { | ||
public function getDefaultLocalization(\Sulu\Component\Webspace\Portal $portal): string | ||
{ | ||
return $portal->getDefaultLocalization(); | ||
} | ||
|
||
public function setDefaultLocalization(\Sulu\Component\Webspace\Portal $portal, \Sulu\Component\Localization\Localization $localization): void | ||
{ | ||
$portal->setDefaultLocalization($localization); | ||
} | ||
|
||
public function isDefault(\Sulu\Component\Localization\Localization $localization): string | ||
{ | ||
return $localization->isDefault(); | ||
} | ||
} | ||
|
||
?> |
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,32 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Sulu\Rector\Tests\Set\Sulu30; | ||
|
||
use Rector\Testing\PHPUnit\AbstractRectorTestCase; | ||
use Symplify\SmartFileSystem\SmartFileInfo; | ||
|
||
final class Sulu30Test extends AbstractRectorTestCase | ||
{ | ||
/** | ||
* @dataProvider provideData() | ||
*/ | ||
public function test(string $fileInfo): void | ||
{ | ||
$this->doTestFile($fileInfo); | ||
} | ||
|
||
/** | ||
* @return \Iterator<SmartFileInfo> | ||
*/ | ||
public function provideData(): \Iterator | ||
{ | ||
return $this->yieldFilesFromDirectory(__DIR__ . '/Fixture'); | ||
} | ||
|
||
public function provideConfigFilePath(): string | ||
{ | ||
return __DIR__ . '/config/sulu-30.php'; | ||
} | ||
} |
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 Sulu\Rector\Set\SuluSetList; | ||
|
||
return static function (RectorConfig $rectorConfig): void { | ||
$rectorConfig->import(__DIR__ . '/../../../../config/config.php'); | ||
$rectorConfig->sets([SuluSetList::SULU_30]); | ||
}; |