Skip to content

Commit

Permalink
Code cleanups and remove old Code
Browse files Browse the repository at this point in the history
  • Loading branch information
lochmueller committed Mar 20, 2024
1 parent d192b5c commit 09d7112
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 75 deletions.
4 changes: 1 addition & 3 deletions Classes/Cache/Rule/NoWorkspacePreview.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ class NoWorkspacePreview extends AbstractRule
{
public function __construct(
private readonly Context $context,
)
{
}
) {}

/**
* Check if it is no workspace preview.
Expand Down
35 changes: 0 additions & 35 deletions Classes/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
8 changes: 4 additions & 4 deletions Resources/Private/Build/PhpCsFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
10 changes: 3 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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"
]
}
}
4 changes: 3 additions & 1 deletion ext_emconf.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/** @var string $_EXTKEY */
$EM_CONF[$_EXTKEY] = [
'title' => 'StaticFileCache',
Expand All @@ -19,7 +21,7 @@
'author_company' => 'StaticFileCache Team',
'autoload' => [
'psr-4' => [
'SFC\\Staticfilecache\\' => 'Classes'
'SFC\\Staticfilecache\\' => 'Classes',
],
],
];
4 changes: 3 additions & 1 deletion ext_localconf.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<?php defined('TYPO3') || die();
<?php

defined('TYPO3') || die();

\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\SFC\Staticfilecache\Configuration::class)->extLocalconf();
3 changes: 0 additions & 3 deletions ext_tables.php

This file was deleted.

25 changes: 4 additions & 21 deletions rector.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
<?php

declare(strict_types=1);
use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
use Ssch\TYPO3Rector\FileProcessor\TypoScript\Rector\v9\v0\FileIncludeToImportStatementTypoScriptRector;

use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
use Rector\ValueObject\PhpVersion;
use Rector\Config\RectorConfig;
use Rector\Core\Configuration\Option;
use Rector\Core\ValueObject\PhpVersion;
use Rector\PostRector\Rector\NameImportingPostRector;
use Ssch\TYPO3Rector\Configuration\Typo3Option;
use Ssch\TYPO3Rector\Rector\General\ConvertImplicitVariablesToExplicitGlobalsRector;
use Ssch\TYPO3Rector\Rector\General\ExtEmConfRector;
use Ssch\TYPO3Rector\Set\Typo3LevelSetList;

return static function (RectorConfig $rectorConfig): void {
$parameters = $rectorConfig->parameters();
$parameters->set(Typo3Option::TYPOSCRIPT_INDENT_SIZE, 4);

$rectorConfig->sets([
Typo3LevelSetList::UP_TO_TYPO3_12,
]);
Expand All @@ -25,7 +18,7 @@

$rectorConfig->paths([
__DIR__ . '/',
]);
]);

$rectorConfig->skip([
// @see https://github.com/sabbelasichon/typo3-rector/issues/2536
Expand All @@ -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);
};

0 comments on commit 09d7112

Please sign in to comment.