Skip to content

Commit

Permalink
[!!!] Do not configure import names per default
Browse files Browse the repository at this point in the history
  • Loading branch information
sabbelasichon committed Apr 15, 2024
1 parent cd9e34a commit 7abca1b
Show file tree
Hide file tree
Showing 148 changed files with 160 additions and 149 deletions.
4 changes: 0 additions & 4 deletions config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@
use Ssch\TYPO3Rector\NodeResolver\Typo3NodeResolver;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->importNames();
$rectorConfig->phpstanConfig(Typo3Option::PHPSTAN_FOR_RECTOR_PATH);
// this will not import root namespace classes, like \DateTime or \Exception
$rectorConfig->importShortClasses(false);

$rectorConfig->singleton(FileInfoFactory::class);
$rectorConfig->singleton(FilesFinder::class);
$rectorConfig->singleton(ExtbaseControllerRedirectAnalyzer::class);
Expand Down
12 changes: 12 additions & 0 deletions config/config_test.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

declare(strict_types=1);

use Rector\Config\RectorConfig;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->importNames();
// this will not import root namespace classes, like \DateTime or \Exception
$rectorConfig->importShortClasses(false);
$rectorConfig->import(__DIR__ . '/config.php');
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Ssch\TYPO3Rector\CodeQuality\General\ConvertImplicitVariablesToExplicitGlobalsRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../../config/config.php');
$rectorConfig->import(__DIR__ . '/../../../../../../../config/config_test.php');

$rectorConfig->rule(ConvertImplicitVariablesToExplicitGlobalsRector::class);
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Ssch\TYPO3Rector\CodeQuality\General\ExtEmConfRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../../config/config.php');
$rectorConfig->import(__DIR__ . '/../../../../../../../config/config_test.php');
$rectorConfig
->ruleWithConfiguration(ExtEmConfRector::class, [
ExtEmConfRector::PHP_VERSION_CONSTRAINT => '7.4.0-8.1.99',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
use Ssch\TYPO3Rector\CodeQuality\General\InjectMethodToConstructorInjectionRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../../config/config.php');
$rectorConfig->import(__DIR__ . '/../../../../../../../config/config_test.php');
$rectorConfig->rule(InjectMethodToConstructorInjectionRector::class);
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Ssch\TYPO3Rector\CodeQuality\General\MethodGetInstanceToMakeInstanceCallRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../../config/config.php');
$rectorConfig->import(__DIR__ . '/../../../../../../../config/config_test.php');
$rectorConfig
->ruleWithConfiguration(MethodGetInstanceToMakeInstanceCallRector::class, [
'TYPO3\CMS\Core\Resource\Index\ExtractorRegistry',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Ssch\TYPO3Rector\CodeQuality\General\RenameClassMapAliasRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../../config/config.php');
$rectorConfig->import(__DIR__ . '/../../../../../../../config/config_test.php');
$rectorConfig->importNames();

$rectorConfig
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
use Ssch\TYPO3Rector\CodeQuality\General\UseExtensionKeyInLocalizationUtilityRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../../config/config.php');
$rectorConfig->import(__DIR__ . '/../../../../../../../config/config_test.php');
$rectorConfig->rule(UseExtensionKeyInLocalizationUtilityRector::class);
};
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Ssch\TYPO3Rector\General\Renaming\ConstantsToBackedEnumValueRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../config/config.php');
$rectorConfig->import(__DIR__ . '/../../../../../../config/config_test.php');
$rectorConfig->phpVersion(PhpVersion::PHP_81);
$rectorConfig->ruleWithConfiguration(ConstantsToBackedEnumValueRector::class, [
new RenameClassAndConstFetch(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Ssch\TYPO3Rector\General\Renaming\ValueObject\RenameAttribute;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../config/config.php');
$rectorConfig->import(__DIR__ . '/../../../../../../config/config_test.php');
$rectorConfig->phpVersion(PhpVersion::PHP_80);
$rectorConfig->ruleWithConfiguration(RenameAttributeRector::class, [
new RenameAttribute('TYPO3\CMS\Backend\Attribute\Controller', 'TYPO3\CMS\Backend\Attribute\AsController'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
use Ssch\TYPO3Rector\TYPO310\v0\BackendUtilityGetViewDomainToPageRouterRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../config/config.php');
$rectorConfig->import(__DIR__ . '/../../../../../../config/config_test.php');
$rectorConfig->rule(BackendUtilityGetViewDomainToPageRouterRector::class);
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
use Ssch\TYPO3Rector\TYPO310\v0\ChangeDefaultCachingFrameworkNamesRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../config/config.php');
$rectorConfig->import(__DIR__ . '/../../../../../../config/config_test.php');
$rectorConfig->rule(ChangeDefaultCachingFrameworkNamesRector::class);
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
use Ssch\TYPO3Rector\TYPO310\v0\ConfigurationManagerAddControllerConfigurationMethodRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../config/config.php');
$rectorConfig->import(__DIR__ . '/../../../../../../config/config_test.php');
$rectorConfig->rule(ConfigurationManagerAddControllerConfigurationMethodRector::class);
};
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../config/config.php');
$rectorConfig->import(__DIR__ . '/../../../../../../config/config_test.php');

$rectorConfig
->ruleWithConfiguration(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Ssch\TYPO3Rector\TYPO310\v0\ForceTemplateParsingInTsfeAndTemplateServiceRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../config/config.php');
$rectorConfig->import(__DIR__ . '/../../../../../../config/config_test.php');

$rectorConfig->rule(ForceTemplateParsingInTsfeAndTemplateServiceRector::class);
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
use Ssch\TYPO3Rector\TYPO310\v0\RefactorIdnaEncodeMethodToNativeFunctionRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../config/config.php');
$rectorConfig->import(__DIR__ . '/../../../../../../config/config_test.php');
$rectorConfig->rule(RefactorIdnaEncodeMethodToNativeFunctionRector::class);
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
use Ssch\TYPO3Rector\TYPO310\v0\RemovePropertyExtensionNameRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../config/config.php');
$rectorConfig->import(__DIR__ . '/../../../../../../config/config_test.php');
$rectorConfig->rule(RemovePropertyExtensionNameRector::class);
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
use Ssch\TYPO3Rector\TYPO310\v0\RemoveSeliconFieldPathRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../config/config.php');
$rectorConfig->import(__DIR__ . '/../../../../../../config/config_test.php');
$rectorConfig->rule(RemoveSeliconFieldPathRector::class);
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
use Ssch\TYPO3Rector\TYPO310\v0\RemoveShowRemovedLocalizationRecordsRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../config/config.php');
$rectorConfig->import(__DIR__ . '/../../../../../../config/config_test.php');
$rectorConfig->rule(RemoveShowRemovedLocalizationRecordsRector::class);
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
use Ssch\TYPO3Rector\TYPO310\v0\RemoveTcaOptionSetToDefaultOnCopyRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../config/config.php');
$rectorConfig->import(__DIR__ . '/../../../../../../config/config_test.php');
$rectorConfig->rule(RemoveTcaOptionSetToDefaultOnCopyRector::class);
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
use Ssch\TYPO3Rector\TYPO310\v0\SetSystemLocaleFromSiteLanguageRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../config/config.php');
$rectorConfig->import(__DIR__ . '/../../../../../../config/config_test.php');
$rectorConfig->rule(SetSystemLocaleFromSiteLanguageRector::class);
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
use Ssch\TYPO3Rector\TYPO310\v0\SwiftMailerBasedMailMessageToMailerBasedMessageRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../config/config.php');
$rectorConfig->import(__DIR__ . '/../../../../../../config/config_test.php');
$rectorConfig->rule(SwiftMailerBasedMailMessageToMailerBasedMessageRector::class);
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
use Rector\Config\RectorConfig;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../config/config.php');
$rectorConfig->import(__DIR__ . '/../../../../../../config/config_test.php');
$rectorConfig->import(__DIR__ . '/../../../../../../config/v10/use-constants-from-typo3-database-connection.php');
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
use Ssch\TYPO3Rector\TYPO310\v0\UseControllerClassesInExtbasePluginsAndModulesRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../config/config.php');
$rectorConfig->import(__DIR__ . '/../../../../../../config/config_test.php');
$rectorConfig->rule(UseControllerClassesInExtbasePluginsAndModulesRector::class);
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
use Ssch\TYPO3Rector\TYPO310\v0\UseMetaDataAspectRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../config/config.php');
$rectorConfig->import(__DIR__ . '/../../../../../../config/config_test.php');
$rectorConfig->rule(UseMetaDataAspectRector::class);
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
use Ssch\TYPO3Rector\TYPO310\v0\UseNativePhpHex2binMethodRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../config/config.php');
$rectorConfig->import(__DIR__ . '/../../../../../../config/config_test.php');
$rectorConfig->rule(UseNativePhpHex2binMethodRector::class);
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
use Ssch\TYPO3Rector\TYPO310\v0\UseTwoLetterIsoCodeFromSiteLanguageRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../config/config.php');
$rectorConfig->import(__DIR__ . '/../../../../../../config/config_test.php');
$rectorConfig->rule(UseTwoLetterIsoCodeFromSiteLanguageRector::class);
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
use Ssch\TYPO3Rector\TYPO310\v1\BackendUtilityEditOnClickRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../config/config.php');
$rectorConfig->import(__DIR__ . '/../../../../../../config/config_test.php');
$rectorConfig->rule(BackendUtilityEditOnClickRector::class);
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
use Ssch\TYPO3Rector\TYPO310\v1\RefactorCHashArrayOfTSFERector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../config/config.php');
$rectorConfig->import(__DIR__ . '/../../../../../../config/config_test.php');
$rectorConfig->rule(RefactorCHashArrayOfTSFERector::class);
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
use Ssch\TYPO3Rector\TYPO310\v1\RefactorInternalPropertiesOfTSFERector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../config/config.php');
$rectorConfig->import(__DIR__ . '/../../../../../../config/config_test.php');
$rectorConfig->rule(RefactorInternalPropertiesOfTSFERector::class);
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
use Ssch\TYPO3Rector\TYPO310\v1\RegisterPluginWithVendorNameRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../config/config.php');
$rectorConfig->import(__DIR__ . '/../../../../../../config/config_test.php');
$rectorConfig->rule(RegisterPluginWithVendorNameRector::class);
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
use Ssch\TYPO3Rector\TYPO310\v1\RemoveEnableMultiSelectFilterTextfieldRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../config/config.php');
$rectorConfig->import(__DIR__ . '/../../../../../../config/config_test.php');
$rectorConfig->rule(RemoveEnableMultiSelectFilterTextfieldRector::class);
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
use Ssch\TYPO3Rector\TYPO310\v1\SendNotifyEmailToMailApiRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../config/config.php');
$rectorConfig->import(__DIR__ . '/../../../../../../config/config_test.php');
$rectorConfig->rule(SendNotifyEmailToMailApiRector::class);
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
use Ssch\TYPO3Rector\TYPO310\v2\ExcludeServiceKeysToArrayRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../config/config.php');
$rectorConfig->import(__DIR__ . '/../../../../../../config/config_test.php');
$rectorConfig->rule(ExcludeServiceKeysToArrayRector::class);
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
use Ssch\TYPO3Rector\TYPO310\v2\InjectEnvironmentServiceIfNeededInResponseRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../config/config.php');
$rectorConfig->import(__DIR__ . '/../../../../../../config/config_test.php');
$rectorConfig->rule(InjectEnvironmentServiceIfNeededInResponseRector::class);
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
use Ssch\TYPO3Rector\TYPO310\v2\MoveApplicationContextToEnvironmentApiRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../config/config.php');
$rectorConfig->import(__DIR__ . '/../../../../../../config/config_test.php');
$rectorConfig->rule(MoveApplicationContextToEnvironmentApiRector::class);
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
use Ssch\TYPO3Rector\TYPO310\v2\UseActionControllerRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../config/config.php');
$rectorConfig->import(__DIR__ . '/../../../../../../config/config_test.php');
$rectorConfig->rule(UseActionControllerRector::class);
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
use Ssch\TYPO3Rector\TYPO310\v2\UseTypo3InformationForCopyRightNoticeRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../config/config.php');
$rectorConfig->import(__DIR__ . '/../../../../../../config/config_test.php');
$rectorConfig->rule(UseTypo3InformationForCopyRightNoticeRector::class);
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
use Ssch\TYPO3Rector\TYPO310\v3\RemoveExcludeOnTransOrigPointerFieldRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../config/config.php');
$rectorConfig->import(__DIR__ . '/../../../../../../config/config_test.php');
$rectorConfig->rule(RemoveExcludeOnTransOrigPointerFieldRector::class);
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
use Ssch\TYPO3Rector\TYPO310\v3\RemoveShowRecordFieldListInsideInterfaceSectionRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../config/config.php');
$rectorConfig->import(__DIR__ . '/../../../../../../config/config_test.php');
$rectorConfig->rule(RemoveShowRecordFieldListInsideInterfaceSectionRector::class);
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
use Ssch\TYPO3Rector\TYPO310\v3\SubstituteResourceFactoryRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../config/config.php');
$rectorConfig->import(__DIR__ . '/../../../../../../config/config_test.php');
$rectorConfig->rule(SubstituteResourceFactoryRector::class);
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
use Ssch\TYPO3Rector\TYPO310\v3\UseClassTypo3InformationRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../config/config.php');
$rectorConfig->import(__DIR__ . '/../../../../../../config/config_test.php');
$rectorConfig->rule(UseClassTypo3InformationRector::class);
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
use Ssch\TYPO3Rector\TYPO310\v3\UseClassTypo3VersionRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../config/config.php');
$rectorConfig->import(__DIR__ . '/../../../../../../config/config_test.php');
$rectorConfig->rule(UseClassTypo3VersionRector::class);
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
use Ssch\TYPO3Rector\TYPO310\v0\RemoveFormatConstantsEmailFinisherRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../config/config.php');
$rectorConfig->import(__DIR__ . '/../../../../../../config/config_test.php');
$rectorConfig->rule(RemoveFormatConstantsEmailFinisherRector::class);
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
use Ssch\TYPO3Rector\TYPO310\v4\SubstituteGeneralUtilityMethodsWithNativePhpFunctionsRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../config/config.php');
$rectorConfig->import(__DIR__ . '/../../../../../../config/config_test.php');
$rectorConfig->rule(SubstituteGeneralUtilityMethodsWithNativePhpFunctionsRector::class);
};
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use TYPO3\CMS\Extbase\Object\ObjectManagerInterface;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../config/config.php');
$rectorConfig->import(__DIR__ . '/../../../../../../config/config_test.php');

$rectorConfig
->ruleWithConfiguration(MethodCallToStaticCallRector::class, [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
use Ssch\TYPO3Rector\TYPO310\v4\UnifiedFileNameValidatorRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../config/config.php');
$rectorConfig->import(__DIR__ . '/../../../../../../config/config_test.php');
$rectorConfig->rule(UnifiedFileNameValidatorRector::class);
};
Loading

0 comments on commit 7abca1b

Please sign in to comment.