From 09d71127e726a8250bbb027484b748b8635d393d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Lochm=C3=BCller?= Date: Wed, 20 Mar 2024 18:49:32 +0100 Subject: [PATCH] Code cleanups and remove old Code --- Classes/Cache/Rule/NoWorkspacePreview.php | 4 +-- Classes/Configuration.php | 35 ----------------------- Resources/Private/Build/PhpCsFixer.php | 8 +++--- composer.json | 10 ++----- ext_emconf.php | 4 ++- ext_localconf.php | 4 ++- ext_tables.php | 3 -- rector.php | 25 +++------------- 8 files changed, 18 insertions(+), 75 deletions(-) delete mode 100755 ext_tables.php diff --git a/Classes/Cache/Rule/NoWorkspacePreview.php b/Classes/Cache/Rule/NoWorkspacePreview.php index a539c500b35..c1770d57dc8 100644 --- a/Classes/Cache/Rule/NoWorkspacePreview.php +++ b/Classes/Cache/Rule/NoWorkspacePreview.php @@ -14,9 +14,7 @@ class NoWorkspacePreview extends AbstractRule { public function __construct( private readonly Context $context, - ) - { - } + ) {} /** * Check if it is no workspace preview. diff --git a/Classes/Configuration.php b/Classes/Configuration.php index c640f64d7a4..1a497993040 100644 --- a/Classes/Configuration.php +++ b/Classes/Configuration.php @@ -78,41 +78,6 @@ public function extLocalconf(): void ; } - /** - * Call in ext_tables.php. - */ - public function extTables(): void - { - $this->registerBackendModule(); - } - - /** - * Add Web>Info module:. - */ - protected function registerBackendModule(): self - { - // see `Configuration/Backend/Modules.php` (since TYPO3 v12) - if ($this->typo3version->getMajorVersion() >= 12) { - return $this; - } - ExtensionUtility::registerModule( - 'Staticfilecache', - 'web', - self::EXTENSION_KEY, - '', - [ - BackendController::class => 'list,boost,support', - ], - [ - 'access' => 'user,group', - 'icon' => 'EXT:staticfilecache/Resources/Public/Icons/Extension.svg', - 'labels' => 'LLL:EXT:staticfilecache/Resources/Private/Language/locallang_mod.xlf', - ] - ); - - return $this; - } - /** * Register hooks. */ diff --git a/Resources/Private/Build/PhpCsFixer.php b/Resources/Private/Build/PhpCsFixer.php index c4da1e07ce4..2388ee92e30 100755 --- a/Resources/Private/Build/PhpCsFixer.php +++ b/Resources/Private/Build/PhpCsFixer.php @@ -10,10 +10,10 @@ require $baseDir . '/.Build/vendor/autoload.php'; $finder = Finder::create() - ->in($baseDir . '/Classes') - ->in($baseDir . '/Tests/Unit') - ->in($baseDir . '/Configuration') - ->in($baseDir . '/Resources/Private/Build') + ->in($baseDir) + ->exclude('.Build') + ->exclude('ext_tables.php') + ->exclude('ext_localconf.php') ; return (new Config()) diff --git a/composer.json b/composer.json index a43a205ba5e..f4d973efe45 100755 --- a/composer.json +++ b/composer.json @@ -47,8 +47,7 @@ "require-dev": { "typo3/testing-framework": "^8.0", "friendsofphp/php-cs-fixer": "^3.30", - "phpmetrics/phpmetrics": "^2.5", - "ssch/typo3-rector": "^1.2", + "ssch/typo3-rector": "^2.2", "phpstan/phpstan": "^1.10", "saschaegerer/phpstan-typo3": "^1.8", "andersundsehr/phpstan-git-files": "^1.0", @@ -82,14 +81,11 @@ "PHP_CS_FIXER_IGNORE_ENV=1 php-cs-fixer fix --config Resources/Private/Build/PhpCsFixer.php --cache-file=.Build/phpcs.cache" ], "code-check": [ - "phpmetrics --report-html=.Build/PhpMetrics . --exclude='.Build,Tests'", - "PHP_CS_FIXER_IGNORE_ENV=1 php-cs-fixer fix --config Resources/Private/Build/PhpCsFixer.php --cache-file=.Build/phpcs.cache --dry-run" + "PHP_CS_FIXER_IGNORE_ENV=1 php-cs-fixer fix --config Resources/Private/Build/PhpCsFixer.php --cache-file=.Build/phpcs.cache --dry-run", + "phpstan --memory-limit=1024M" ], "test": [ "phpunit -c Tests/UnitTests.xml" - ], - "phpstan": [ - "phpstan --memory-limit=1024M" ] } } diff --git a/ext_emconf.php b/ext_emconf.php index fcd449b5018..2bfc34d1e38 100755 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -1,5 +1,7 @@ 'StaticFileCache', @@ -19,7 +21,7 @@ 'author_company' => 'StaticFileCache Team', 'autoload' => [ 'psr-4' => [ - 'SFC\\Staticfilecache\\' => 'Classes' + 'SFC\\Staticfilecache\\' => 'Classes', ], ], ]; diff --git a/ext_localconf.php b/ext_localconf.php index 534ffc75fd7..0e9ad6a6a02 100755 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -1,3 +1,5 @@ -extLocalconf(); diff --git a/ext_tables.php b/ext_tables.php deleted file mode 100755 index 5e451843c38..00000000000 --- a/ext_tables.php +++ /dev/null @@ -1,3 +0,0 @@ -extTables(); diff --git a/rector.php b/rector.php index ac6bc342fa0..63fdc6b5a48 100644 --- a/rector.php +++ b/rector.php @@ -1,22 +1,15 @@ parameters(); - $parameters->set(Typo3Option::TYPOSCRIPT_INDENT_SIZE, 4); - $rectorConfig->sets([ Typo3LevelSetList::UP_TO_TYPO3_12, ]); @@ -25,7 +18,7 @@ $rectorConfig->paths([ __DIR__ . '/', - ]); + ]); $rectorConfig->skip([ // @see https://github.com/sabbelasichon/typo3-rector/issues/2536 @@ -48,16 +41,6 @@ 'ClassAliasMap.php', __DIR__ . '/**/Configuration/*.php', __DIR__ . '/**/Configuration/**/*.php', - ] + ], ]); - - - $rectorConfig->rule(StringClassNameToClassConstantRector::class); - - $rectorConfig->rule(ConvertImplicitVariablesToExplicitGlobalsRector::class); - $rectorConfig->ruleWithConfiguration(ExtEmConfRector::class, [ - ExtEmConfRector::ADDITIONAL_VALUES_TO_BE_REMOVED => [] - ]); - - $rectorConfig->rule(FileIncludeToImportStatementTypoScriptRector::class); };