Skip to content
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
13 changes: 8 additions & 5 deletions config/v14/rename-classes.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,19 @@
return static function (RectorConfig $rectorConfig): void {
$rectorConfig
->ruleWithConfiguration(RenameClassRector::class, [
'TYPO3\CMS\Backend\Backend\ToolbarItems\ShortcutToolbarItem' => 'TYPO3\CMS\Backend\Backend\ToolbarItems\BookmarkToolbarItem',
'TYPO3\CMS\Backend\Controller\ShortcutController' => 'TYPO3\CMS\Backend\Controller\BookmarkController',
'TYPO3\CMS\Install\Attribute\UpgradeWizard' => 'TYPO3\CMS\Core\Attribute\UpgradeWizard',
'TYPO3\CMS\Install\Command\LanguagePackCommand' => 'TYPO3\CMS\Core\Command\UpdateLanguagePackCommand',
'TYPO3\CMS\Install\Service\Event\ModifyLanguagePackRemoteBaseUrlEvent' => 'TYPO3\CMS\Core\Localization\Event\ModifyLanguagePackRemoteBaseUrlEvent',
'TYPO3\CMS\Install\Service\Event\ModifyLanguagePacksEvent' => 'TYPO3\CMS\Core\Localization\Event\ModifyLanguagePacksEvent',
'TYPO3\CMS\Install\Updates\AbstractListTypeToCTypeUpdate' => 'TYPO3\CMS\Core\Upgrades\AbstractListTypeToCTypeUpdate',
'TYPO3\CMS\Install\Updates\ChattyInterface' => 'TYPO3\CMS\Core\Upgrades\ChattyInterface',
'TYPO3\CMS\Install\Updates\ConfirmableInterface' => 'TYPO3\CMS\Core\Upgrades\ConfirmableInterface',
'TYPO3\CMS\Install\Updates\RepeatableInterface' => 'TYPO3\CMS\Core\Upgrades\RepeatableInterface',
'TYPO3\CMS\Install\Updates\UpgradeWizardInterface' => 'TYPO3\CMS\Core\Upgrades\UpgradeWizardInterface',
'TYPO3\CMS\Install\Updates\AbstractListTypeToCTypeUpdate' => 'TYPO3\CMS\Core\Upgrades\AbstractListTypeToCTypeUpdate',
'TYPO3\CMS\Install\Updates\DatabaseUpdatedPrerequisite' => 'TYPO3\CMS\Core\Upgrades\DatabaseUpdatedPrerequisite',
'TYPO3\CMS\Install\Updates\ReferenceIndexUpdatedPrerequisite' => 'TYPO3\CMS\Core\Upgrades\ReferenceIndexUpdatedPrerequisite',
'TYPO3\CMS\Backend\Controller\ShortcutController' => 'TYPO3\CMS\Backend\Controller\BookmarkController',
'TYPO3\CMS\Backend\Backend\ToolbarItems\ShortcutToolbarItem' => 'TYPO3\CMS\Backend\Backend\ToolbarItems\BookmarkToolbarItem',
'TYPO3\CMS\Install\Updates\RepeatableInterface' => 'TYPO3\CMS\Core\Upgrades\RepeatableInterface',
'TYPO3\CMS\Install\Updates\UpgradeWizardInterface' => 'TYPO3\CMS\Core\Upgrades\UpgradeWizardInterface',
'TYPO3\CMS\Setup\Event\AddJavaScriptModulesEvent' => 'TYPO3\CMS\Backend\Event\AddUserSettingsJavaScriptModulesEvent',
'TYPO3\CMS\Setup\Form\Element\AvatarElement' => 'TYPO3\CMS\Backend\Form\Element\AvatarElement',
'TYPO3\CMS\Setup\UserFunctions\UserSettingsItemsProcFunc' => 'TYPO3\CMS\Backend\UserFunctions\UserSettingsItemsProcFunc',
Expand Down
48 changes: 48 additions & 0 deletions rules/TYPO314/v2/MoveLanguagePackCommandAndEventsToCoreRector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php

declare(strict_types=1);

namespace Ssch\TYPO3Rector\TYPO314\v2;

use PhpParser\Node;
use Rector\Rector\AbstractRector;
use Rector\RuleDoc\CodeSample\CodeSample;
use Rector\RuleDoc\Contract\DocumentedRuleInterface;
use Rector\RuleDoc\RuleDefinition;

/**
* @changelog https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/14.2/Deprecation-109027-MoveLanguageUpdateCommandAndEventsToEXTcore.html
* @see \Ssch\TYPO3Rector\Tests\Rector\v14\v2\MoveLanguagePackCommandAndEventsToCoreRector\MoveLanguagePackCommandAndEventsToCoreRectorTest
*/
final class MoveLanguagePackCommandAndEventsToCoreRector extends AbstractRector implements DocumentedRuleInterface
{
public function getRuleDefinition(): RuleDefinition
{
return new RuleDefinition('Move language:update command and language pack events to EXT:core', [new CodeSample(
<<<'CODE_SAMPLE'
use TYPO3\CMS\Install\Command\LanguagePackCommand;
use TYPO3\CMS\Install\Service\Event\ModifyLanguagePackRemoteBaseUrlEvent;
use TYPO3\CMS\Install\Service\Event\ModifyLanguagePacksEvent;
CODE_SAMPLE
,
<<<'CODE_SAMPLE'
use TYPO3\CMS\Core\Command\UpdateLanguagePackCommand;
use TYPO3\CMS\Core\Localization\Event\ModifyLanguagePackRemoteBaseUrlEvent;
use TYPO3\CMS\Core\Localization\Event\ModifyLanguagePacksEvent;
CODE_SAMPLE
)]);
}

/**
* @return array<class-string<Node>>
*/
public function getNodeTypes(): array
{
return [];
}

public function refactor(Node $node): ?Node
{
return null;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php

namespace Ssch\TYPO3Rector\Tests\Rector\v14\v2\MoveLanguagePackCommandAndEventsToCoreRector\Fixture;

use TYPO3\CMS\Install\Command\LanguagePackCommand;
use TYPO3\CMS\Install\Service\Event\ModifyLanguagePackRemoteBaseUrlEvent;
use TYPO3\CMS\Install\Service\Event\ModifyLanguagePacksEvent;

final class MyEventListener
{
public function modifyLanguagePacks(ModifyLanguagePacksEvent $event): void
{
}

public function modifyRemoteBaseUrl(ModifyLanguagePackRemoteBaseUrlEvent $event): void
{
}
}

final class MyCommand extends LanguagePackCommand
{
}
?>
-----
<?php

namespace Ssch\TYPO3Rector\Tests\Rector\v14\v2\MoveLanguagePackCommandAndEventsToCoreRector\Fixture;

use TYPO3\CMS\Core\Localization\Event\ModifyLanguagePacksEvent;
use TYPO3\CMS\Core\Localization\Event\ModifyLanguagePackRemoteBaseUrlEvent;
use TYPO3\CMS\Core\Command\UpdateLanguagePackCommand;

final class MyEventListener
{
public function modifyLanguagePacks(ModifyLanguagePacksEvent $event): void
{
}

public function modifyRemoteBaseUrl(ModifyLanguagePackRemoteBaseUrlEvent $event): void
{
}
}

final class MyCommand extends UpdateLanguagePackCommand
{
}
?>
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

declare(strict_types=1);

namespace Ssch\TYPO3Rector\Tests\Rector\v14\v2\MoveLanguagePackCommandAndEventsToCoreRector;

use Rector\Testing\PHPUnit\AbstractRectorTestCase;

final class MoveLanguagePackCommandAndEventsToCoreRectorTest extends AbstractRectorTestCase
{
/**
* @dataProvider provideData()
*/
public function test(string $filePath): void
{
$this->doTestFile($filePath);
}

/**
* @return \Iterator<array<string>>
*/
public static function provideData(): \Iterator
{
return self::yieldFilesFromDirectory(__DIR__ . '/Fixture');
}

public function provideConfigFilePath(): string
{
return __DIR__ . '/config/configured_rule.php';
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

declare(strict_types=1);

use Rector\Config\RectorConfig;
use Rector\ValueObject\PhpVersion;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../config/config_test.php');
if (\PHP_VERSION_ID >= PhpVersion::PHP_81) {
$rectorConfig->phpVersion(PhpVersion::PHP_81);
} elseif (\PHP_VERSION_ID >= PhpVersion::PHP_80) {
$rectorConfig->phpVersion(PhpVersion::PHP_80);
} else {
$rectorConfig->phpVersion(PhpVersion::PHP_74);
}

$rectorConfig->import(__DIR__ . '/../../../../../../config/v14/rename-classes.php');
};