diff --git a/.editorconfig b/.editorconfig index 379a529..49c056d 100644 --- a/.editorconfig +++ b/.editorconfig @@ -3,58 +3,17 @@ # top-most EditorConfig file root = true -# Unix-style newlines with a newline ending every file [*] charset = utf-8 end_of_line = lf -indent_style = space indent_size = 4 +indent_style = space insert_final_newline = true trim_trailing_whitespace = true +max_line_length = 180 -# TS/JS-Files -[*.{ts,js}] -indent_size = 2 - -# JSON-Files -[*.json] -indent_style = tab - -# ReST-Files -[*.{rst,rst.txt}] -indent_size = 4 -max_line_length = 80 - -# Markdown-Files -[*.md] -max_line_length = 80 - -# YAML-Files -[*.{yaml,yml}] -indent_size = 2 +[*.php] +max_line_length = 115 -# NEON-Files -[*.neon] +[{*.yml,*.yaml}] indent_size = 2 -indent_style = tab - -# package.json -[package.json] -indent_size = 2 - -# TypoScript -[*.{typoscript,tsconfig}] -indent_size = 2 - -# XLF-Files -[*.xlf] -indent_style = tab - -# SQL-Files -[*.sql] -indent_style = tab -indent_size = 2 - -# .htaccess -[{_.htaccess,.htaccess}] -indent_style = tab \ No newline at end of file diff --git a/.github/workflows/apply-coding-standard.yml b/.github/workflows/apply-coding-standard.yml index 3aacf0b..bdf44aa 100644 --- a/.github/workflows/apply-coding-standard.yml +++ b/.github/workflows/apply-coding-standard.yml @@ -16,7 +16,7 @@ jobs: - name: 'Setup PHP' uses: shivammathur/setup-php@v2 with: - php-version: '8.1' + php-version: '8.3' tools: composer - name: 'Get Composer Cache Directory' @@ -37,23 +37,32 @@ jobs: - name: 'Rector PHP Code' shell: bash - run: composer rector-fix + run: composer rector:fix - - name: 'Lint PHP Code' + - name: 'Normalize Composer files' shell: bash - run: composer lint-fix + run: composer composer:normalize:fix + + - name: 'PHP syntax checker' + shell: bash + run: composer php:lint + + - name: 'Prettier' + shell: bash + continue-on-error: true + run: ./prettier.sh --write - name: 'Run PHPUnit unit tests' shell: bash - run: composer test-unit + run: composer test:unit - name: 'Run PHPUnit functional tests' shell: bash - run: composer test-functional + run: composer test:functional - name: 'Create pull-request' id: cpr - uses: peter-evans/create-pull-request@v6.0.5 + uses: peter-evans/create-pull-request@v7.0.3 with: token: ${{ secrets.GITHUB_TOKEN }} commit-message: "[automated] Apply Coding Standard" @@ -67,4 +76,4 @@ jobs: if: steps.cpr.outputs.pull-request-operation == 'created' run: gh pr merge --auto "${{ steps.cpr.outputs.pull-request-number }}" env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9e12a69..985ef1e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,12 +20,12 @@ permissions: jobs: test: runs-on: ubuntu-latest - name: TYPO3 v12.4 tests on PHP ${{ matrix.php }} + name: TYPO3 v13.4 tests on PHP ${{ matrix.php }} strategy: fail-fast: false matrix: - php: [ 8.1, 8.2, 8.3 ] + php: [ 8.3, 8.4 ] steps: - name: 'Checkout code' @@ -61,18 +61,18 @@ jobs: - name: 'PHPUnit unit tests' shell: bash - run: composer test-unit + run: composer test:unit - name: 'PHPUnit functional tests' shell: bash - run: composer test-functional + run: composer test:functional - name: 'Merge Coverage Reports' shell: bash run: .Build/bin/phpcov merge --html .Build/artifacts/coverage/merged --clover .Build/artifacts/coverage/clover.xml .Build/artifacts/coverage/ - name: 'Generate code coverage summary report' - uses: saschanowak/CloverCodeCoverageSummary@1.0.1 + uses: saschanowak/CloverCodeCoverageSummary@1.1.0 with: filename: .Build/artifacts/coverage/clover.xml @@ -83,11 +83,11 @@ jobs: - name: 'Add title to code coverage summary' shell: bash - run: sed -i '1 i\## TYPO3 v12.4 tests on PHP ${{ matrix.php }}' code-coverage-summary.md + run: sed -i '1 i\## TYPO3 v13.4 tests on PHP ${{ matrix.php }}' code-coverage-summary.md - name: 'Add code coverage summary as pr comment' uses: marocchino/sticky-pull-request-comment@v2 with: header: coverage-${{ matrix.php }} recreate: true - path: code-coverage-summary.md \ No newline at end of file + path: code-coverage-summary.md diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 0000000..7d71a84 --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,15 @@ +{ + "arrowParens": "avoid", + "quoteProps": "consistent", + "printWidth": 180, + "singleQuote": true, + "overrides": [ + { + "files": ["*.php"], + "options": { + "printWidth": 115, + "plugins": ["@prettier/plugin-php"] + } + } + ] +} diff --git a/Classes/EventListener/AddCdnToResource.php b/Classes/EventListener/AddCdnToResource.php index 26b5118..bff7568 100644 --- a/Classes/EventListener/AddCdnToResource.php +++ b/Classes/EventListener/AddCdnToResource.php @@ -4,10 +4,11 @@ namespace Netlogix\Nxsimplecdn\EventListener; -use Netlogix\Nxsimplecdn\Service\BaseUriService; -use TYPO3\CMS\Core\Configuration\ExtensionConfiguration; +use Symfony\Component\DependencyInjection\Attribute\Autowire; +use TYPO3\CMS\Core\Attribute\AsEventListener; use TYPO3\CMS\Core\Http\ApplicationType; use TYPO3\CMS\Core\Http\Uri; +use TYPO3\CMS\Core\Resource\Capabilities; use TYPO3\CMS\Core\Resource\Driver\DriverInterface; use TYPO3\CMS\Core\Resource\Driver\LocalDriver; use TYPO3\CMS\Core\Resource\Event\GeneratePublicUrlForResourceEvent; @@ -15,24 +16,23 @@ use TYPO3\CMS\Core\Resource\OnlineMedia\Helpers\OnlineMediaHelperRegistry; use TYPO3\CMS\Core\Resource\ProcessedFile; use TYPO3\CMS\Core\Resource\ResourceInterface; -use TYPO3\CMS\Core\Resource\ResourceStorageInterface; use TYPO3\CMS\Core\Utility\GeneralUtility; -class AddCdnToResource +#[AsEventListener] +readonly class AddCdnToResource { - protected $configuration = []; - public function __construct(ExtensionConfiguration $extensionConfiguration = null) - { - $this->configuration = $extensionConfiguration instanceof ExtensionConfiguration ? $extensionConfiguration->get( - 'nxsimplecdn' - ) : - GeneralUtility::makeInstance(ExtensionConfiguration::class)->get('nxsimplecdn'); + public function __construct( + #[Autowire(expression: 'service("Netlogix\\\Nxsimplecdn\\\Service\\\BaseUriService").getBaseUri().getHost()')] + protected string $cdnDomainHost, + #[Autowire(expression: 'service("TYPO3\\\CMS\\\Core\\\Configuration\\\ExtensionConfiguration").get("nxsimplecdn", "enabled")')] + protected bool $enabled = false, + ) { } public function __invoke(GeneratePublicUrlForResourceEvent $event): void { - if (!(bool) $this->configuration['enabled']) { + if ($this->enabled === false) { return; } @@ -54,10 +54,7 @@ public function __invoke(GeneratePublicUrlForResourceEvent $event): void return; } - if ( - ($resource->getStorage()->getCapabilities() & ResourceStorageInterface::CAPABILITY_PUBLIC) - !== ResourceStorageInterface::CAPABILITY_PUBLIC - ) { + if ($resource->getStorage()->getCapabilities()->hasCapability(Capabilities::CAPABILITY_PUBLIC) === false) { return; } @@ -74,12 +71,11 @@ public function __invoke(GeneratePublicUrlForResourceEvent $event): void private function addCdnPrefixToUrl(ResourceInterface $resourceObject, DriverInterface $driver): string { $publicUrl = $driver->getPublicUrl($resourceObject->getIdentifier()); - $cdnBaseUrl = GeneralUtility::makeInstance(BaseUriService::class)->getBaseUri(); if (!$resourceObject instanceof ProcessedFile) { $publicUrl = GeneralUtility::createVersionNumberedFilename($publicUrl); } return (string) (new Uri($publicUrl))->withScheme('https') - ->withHost($cdnBaseUrl->getHost()); + ->withHost($this->cdnDomainHost); } } diff --git a/Classes/EventListener/AddFileCacheTagForTypolink.php b/Classes/EventListener/AddFileCacheTagForTypolink.php deleted file mode 100644 index a7e42c7..0000000 --- a/Classes/EventListener/AddFileCacheTagForTypolink.php +++ /dev/null @@ -1,47 +0,0 @@ -getLinkResult()->getType() !== 'file') { - return; - } - - if (!array_key_exists('href', $event->getContentObjectRenderer()->parameters)) { - return; - } - - $linkService = GeneralUtility::makeInstance(LinkService::class); - $resolvedLink = $linkService->resolveByStringRepresentation( - $event - ->getContentObjectRenderer() - ->parameters['href'] - ); - - if (!array_key_exists('file', $resolvedLink)) { - return; - } - - /** @var FileInterface $file */ - $file = $resolvedLink['file']; - - $this->getTypoScriptFrontendController() - ->addCacheTags(['sys_file_' . (int) $file->getProperty('uid')]); - } - - private function getTypoScriptFrontendController(): TypoScriptFrontendController - { - return $GLOBALS['TSFE']; - } -} diff --git a/Classes/EventListener/FlushCacheTagForFile.php b/Classes/EventListener/FlushCacheTagForFile.php deleted file mode 100644 index 1c72e4c..0000000 --- a/Classes/EventListener/FlushCacheTagForFile.php +++ /dev/null @@ -1,48 +0,0 @@ -flushCacheByFile($event->getFile()); - } - - public function afterFileDeleted(AfterFileDeletedEvent $event): void - { - $this->flushCacheByFile($event->getFile()); - } - - public function afterFileRenamed(AfterFileRenamedEvent $event): void - { - $this->flushCacheByFile($event->getFile()); - } - - public function afterFileReplaced(AfterFileReplacedEvent $event): void - { - $this->flushCacheByFile($event->getFile()); - } - - public function afterFileContentsSet(AfterFileContentsSetEvent $event): void - { - $this->flushCacheByFile($event->getFile()); - } - - private function flushCacheByFile(FileInterface $file): void - { - $cacheManager = GeneralUtility::makeInstance(CacheManager::class); - $cacheManager->flushCachesByTag('sys_file_' . (int) $file->getProperty('uid')); - } -} diff --git a/Classes/Service/BaseUriService.php b/Classes/Service/BaseUriService.php index 02b9779..68f8ac7 100644 --- a/Classes/Service/BaseUriService.php +++ b/Classes/Service/BaseUriService.php @@ -10,7 +10,7 @@ use TYPO3\CMS\Core\Http\Uri; use TYPO3\CMS\Core\Site\Entity\Site; -class BaseUriService +final class BaseUriService { public function getBaseUri(): UriInterface { diff --git a/Configuration/Services.yaml b/Configuration/Services.yaml index 42d18b1..76d98cb 100644 --- a/Configuration/Services.yaml +++ b/Configuration/Services.yaml @@ -7,45 +7,6 @@ services: Netlogix\Nxsimplecdn\: resource: '../Classes/*' - Netlogix\Nxsimplecdn\EventListener\AddCdnToResource: - tags: - - name: event.listener - identifier: 'nxsimplecdn/generatePublicUrlForResourceListener' - event: TYPO3\CMS\Core\Resource\Event\GeneratePublicUrlForResourceEvent - - Netlogix\Nxsimplecdn\EventListener\FlushCacheTagForFile: - tags: - - name: event.listener - identifier: 'nxsimplecdn/flushCacheAfterFileContentsSet' - method: 'afterFileContentsSet' - event: TYPO3\CMS\Core\Resource\Event\AfterFileContentsSetEvent - - - name: event.listener - identifier: 'nxsimplecdn/flushCacheAfterFileDeleted' - method: 'afterFileDeleted' - event: TYPO3\CMS\Core\Resource\Event\AfterFileDeletedEvent - - - name: event.listener - identifier: 'nxsimplecdn/flushCacheAfterFileMoved' - method: 'afterFileMoved' - event: TYPO3\CMS\Core\Resource\Event\AfterFileMovedEvent - - - name: event.listener - identifier: 'nxsimplecdn/flushCacheAfterFileRenamed' - method: 'afterFileRenamed' - event: TYPO3\CMS\Core\Resource\Event\AfterFileRenamedEvent - - - name: event.listener - identifier: 'nxsimplecdn/flushCacheAfterFileReplaced' - method: 'afterFileReplaced' - event: TYPO3\CMS\Core\Resource\Event\AfterFileReplacedEvent - - Netlogix\Nxsimplecdn\EventListener\AddFileCacheTagForTypolink: - tags: - - name: event.listener - identifier: 'nxsimplecdn/addFileCacheTagForTypolink' - event: TYPO3\CMS\Frontend\Event\AfterLinkIsGeneratedEvent - Netlogix\Nxsimplecdn\Xclass\PageRenderer: arguments: $assetsCache: '@cache.assets' diff --git a/README.md b/README.md index 04bd1c8..043777b 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # TYPO3 Extension nxsimplecdn -[![stability-beta](https://img.shields.io/badge/stability-beta-33bbff.svg)](https://github.com/netlogix/nxsimplecdn) -[![TYPO3 V12](https://img.shields.io/badge/TYPO3-12-orange.svg)](https://get.typo3.org/version/12) -[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%208.1-8892BF.svg)](https://php.net/) +[![stability-stable](https://img.shields.io/badge/stability-stable-33bbff.svg)](https://github.com/netlogix/nxsimplecdn) +[![TYPO3 V13](https://img.shields.io/badge/TYPO3-13-orange.svg)](https://get.typo3.org/version/13) +[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%208.3-8892BF.svg)](https://php.net/) [![GitHub CI status](https://github.com/netlogix/nxsimplecdn/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/netlogix/nxsimplecdn/actions) # Installation diff --git a/composer.json b/composer.json index 6c831dc..723feff 100644 --- a/composer.json +++ b/composer.json @@ -4,15 +4,13 @@ "license": "MIT", "type": "typo3-cms-extension", "require": { - "php": "^8.1", - "typo3/cms-core": "^12.4" + "typo3/cms-core": "^13.4" }, "require-dev": { "ext-sqlite3": "*", - "ssch/typo3-rector": "^1.5", - "typo3/testing-framework": "^8.0", - "phpunit/phpcov": "^9.0", - "netlogix/coding-guidelines-php": "^1.0" + "ssch/typo3-rector": "^3.0", + "typo3/testing-framework": "^9.0", + "phpunit/phpcov": "^10.0" }, "autoload": { "psr-4": { @@ -34,17 +32,20 @@ "vendor-dir": ".Build/vendor", "bin-dir": ".Build/bin", "allow-plugins": { + "ergebnis/composer-normalize": true, "typo3/cms-composer-installers": true, "typo3/class-alias-loader": true } }, "scripts": { + "composer:normalize": "@composer normalize --no-check-lock --dry-run", + "composer:normalize:fix": "@composer normalize --no-check-lock", + "composer:psr-verify": "@composer dumpautoload --optimize --strict-psr --no-plugins", + "php:lint": "find src -name '*.php' -print0 | xargs -r -0 -n 1 -P 4 php -l", "rector": "rector process --dry-run", - "rector-fix": "rector process", - "lint": "ecs check", - "lint-fix": "ecs check --fix", - "test-unit": "phpunit -c phpunit.xml", - "test-functional": "phpunit -c phpunit_functional.xml", + "rector:fix": "rector process", + "test:unit": "phpunit -c phpunit.xml", + "test:functional": "phpunit -c phpunit_functional.xml", "post-autoload-dump": [ "@prepare-extension-test-structure" ], diff --git a/ecs.php b/ecs.php deleted file mode 100644 index acaa345..0000000 --- a/ecs.php +++ /dev/null @@ -1,27 +0,0 @@ -configure($ecsConfig); - - $ecsConfig->paths( - [ - __DIR__ . '/Classes', - __DIR__ . '/Configuration', - __DIR__ . '/Tests', - __DIR__ . '/ext_localconf.php', - ] - ); - - $ecsConfig->skip([ - DeclareStrictTypesFixer::class => [ - __DIR__ . '/ext_tables.php', - __DIR__ . '/Configuration/TCA/*', - ] - ]); -}; diff --git a/prettier.sh b/prettier.sh new file mode 100755 index 0000000..05e1a73 --- /dev/null +++ b/prettier.sh @@ -0,0 +1,16 @@ +#!/bin/bash +CMD=$@ + +if [[ $# -eq 0 ]]; then + echo "No arguments supplied using --check as default. If you want to format files use --write." + CMD="--check" +fi + +INTERACTIVE_MODE="-it" + +if [[ -n "${CI}" ]]; then + echo "Running on CI, disabling interactive mode." + INTERACTIVE_MODE="" +fi + +docker run --rm $INTERACTIVE_MODE -v $(pwd):/home/prettier/code ghcr.io/netlogix/docker/prettier:stable $CMD diff --git a/rector.php b/rector.php index 2e8896c..28d105f 100644 --- a/rector.php +++ b/rector.php @@ -2,166 +2,66 @@ declare(strict_types=1); -use Rector\CodingStyle\Rector\ClassMethod\UnSpreadOperatorRector; use Rector\Config\RectorConfig; -use Rector\Core\Configuration\Option; -use Rector\Core\ValueObject\PhpVersion; -use Rector\Php74\Rector\LNumber\AddLiteralSeparatorToNumberRector; -use Rector\PHPUnit\Set\PHPUnitLevelSetList; -use Rector\PostRector\Rector\NameImportingPostRector; +use Rector\Php81\Rector\Array_\FirstClassCallableRector; +use Rector\PHPUnit\Set\PHPUnitSetList; use Rector\Set\ValueObject\LevelSetList; use Rector\Set\ValueObject\SetList; -use Rector\TypeDeclaration\Rector\Property\TypedPropertyFromStrictConstructorRector; -use Ssch\TYPO3Rector\Rector\General\ConvertImplicitVariablesToExplicitGlobalsRector; -use Ssch\TYPO3Rector\Rector\General\ExtEmConfRector; -use Ssch\TYPO3Rector\Rector\v11\v0\SubstituteConstantsModeAndRequestTypeRector; -use Ssch\TYPO3Rector\Set\Extension\NimutTestingFrameworkSetList; +use Rector\TypeDeclaration\Rector\StmtsAwareInterface\DeclareStrictTypesRector; +use Ssch\TYPO3Rector\CodeQuality\General\ConvertImplicitVariablesToExplicitGlobalsRector; +use Ssch\TYPO3Rector\Configuration\Typo3Option; use Ssch\TYPO3Rector\Set\Typo3LevelSetList; -use Ssch\TYPO3Rector\Set\Typo3SetList; - -return static function (RectorConfig $rectorConfig): void { - - // If you want to override the number of spaces for your typoscript files you can define it here, the default value is 4 - // $parameters = $rectorConfig->parameters(); - // $parameters->set(Typo3Option::TYPOSCRIPT_INDENT_SIZE, 2); - - $rectorConfig->sets([ - // PHP - LevelSetList::UP_TO_PHP_81, +return RectorConfig::configure() + ->withPaths([ + __DIR__ . '/Classes', + __DIR__ . '/Configuration', + __DIR__ . '/Tests', + ]) + ->withPhpSets(true) + ->withAttributesSets( + doctrine: true, + phpunit: true, + ) + ->withPreparedSets( + deadCode: true, + codeQuality: true, + codingStyle: true, + typeDeclarations: true, + instanceOf: true, + earlyReturn: true, + strictBooleans: true, + ) + ->withImportNames(removeUnusedImports: true) + ->withSets([ + LevelSetList::UP_TO_PHP_83, SetList::CODE_QUALITY, SetList::CODING_STYLE, SetList::DEAD_CODE, SetList::TYPE_DECLARATION, SetList::EARLY_RETURN, SetList::INSTANCEOF, - - // PhpUnit - PHPUnitLevelSetList::UP_TO_PHPUNIT_100, - - // TYPO3 - // v7 - Typo3SetList::TCA_76, - - // v8 - Typo3SetList::TCA_87, - - // v9 - Typo3SetList::TCA_95, - Typo3SetList::EXTBASE_COMMAND_CONTROLLERS_TO_SYMFONY_COMMANDS, - - // v10 - Typo3SetList::TCA_104, - Typo3SetList::TYPOSCRIPT_CONDITIONS_95, - Typo3SetList::TYPOSCRIPT_100, - Typo3SetList::TYPOSCRIPT_CONDITIONS_104, - Typo3SetList::DATABASE_TO_DBAL, - - // v11 - Typo3SetList::TCA_114, - Typo3SetList::REGISTER_ICONS_TO_ICON, - - // v12 - Typo3SetList::TCA_120, - Typo3SetList::TCA_123, - Typo3SetList::TYPOSCRIPT_120, - - // Typo3LevelSetList::UP_TO_TYPO3_7, - // Typo3LevelSetList::UP_TO_TYPO3_8, - // Typo3LevelSetList::UP_TO_TYPO3_9, - // Typo3LevelSetList::UP_TO_TYPO3_10, - // Typo3LevelSetList::UP_TO_TYPO3_11, - Typo3LevelSetList::UP_TO_TYPO3_12, - - NimutTestingFrameworkSetList::NIMUT_TESTING_FRAMEWORK_TO_TYPO3_TESTING_FRAMEWORK - ]); - - $rectorConfig->rule(SubstituteConstantsModeAndRequestTypeRector::class); - - // Define your target version which you want to support - $rectorConfig->phpVersion(PhpVersion::PHP_81); - - $parameters = $rectorConfig->parameters(); - $parameters->set(Option::IMPORT_SHORT_CLASSES, false); - $parameters->set(Option::AUTO_IMPORT_DOC_BLOCK_NAMES, false); - - // If you only want to process one/some TYPO3 extension(s), you can specify its path(s) here. - // If you use the option --config change __DIR__ to getcwd() - $rectorConfig->paths([ - __DIR__, - ]); - - // When you use rector there are rules that require some more actions like creating UpgradeWizards for outdated TCA types. - // To fully support you we added some warnings. So watch out for them. - - // If you use importNames(), you should consider excluding some TYPO3 files. - $rectorConfig->skip([ - // PHP - AddLiteralSeparatorToNumberRector::class, - UnSpreadOperatorRector::class => [ - __DIR__ . '/Classes/Service/LocationFactory.php', - ], - TypedPropertyFromStrictConstructorRector::class => [ - __DIR__ . '/Classes/Service/Importer.php', - ], - - // TYPO3 + Typo3LevelSetList::UP_TO_TYPO3_13, + PHPUnitSetList::PHPUNIT_100, + PHPUnitSetList::PHPUNIT_CODE_QUALITY, + PHPUnitSetList::ANNOTATIONS_TO_ATTRIBUTES, + ]) + # To have a better analysis from PHPStan, we teach it here some more things + ->withPHPStanConfigs([Typo3Option::PHPSTAN_FOR_RECTOR_PATH]) + ->withRules([ + ConvertImplicitVariablesToExplicitGlobalsRector::class, + DeclareStrictTypesRector::class, + ]) + # If you use withImportNames(), you should consider excluding some TYPO3 files. + ->withSkip([ // @see https://github.com/sabbelasichon/typo3-rector/issues/2536 - __DIR__ . '/**/Configuration/ExtensionBuilder/*', - // We skip those directories on purpose as there might be node_modules or similar - // that include typescript which would result in false positive processing - __DIR__ . '/**/Resources/**/node_modules/*', - __DIR__ . '/**/Resources/**/NodeModules/*', - __DIR__ . '/**/Resources/**/BowerComponents/*', - __DIR__ . '/**/Resources/**/bower_components/*', - __DIR__ . '/**/Resources/**/build/*', - __DIR__ . '/**/Resources/**/App/*', - __DIR__ . '/**/Resources/Public/*', + __DIR__ . '/Resources/*', __DIR__ . '/vendor/*', __DIR__ . '/Build/*', __DIR__ . '/public/*', __DIR__ . '/.github/*', __DIR__ . '/.Build/*', - NameImportingPostRector::class => [ - 'ext_localconf.php', - 'ext_tables.php', - 'ClassAliasMap.php', - __DIR__ . '/**/Configuration/*.php', - __DIR__ . '/**/Configuration/**/*.php', - ] - ]); - - // If you have trouble that rector cannot run because some TYPO3 constants are not defined add an additional constants file - // @see https://github.com/sabbelasichon/typo3-rector/blob/master/typo3.constants.php - // @see https://github.com/rectorphp/rector/blob/main/docs/static_reflection_and_autoload.md#include-files - // $parameters->set(Option::BOOTSTRAP_FILES, [ - // __DIR__ . '/typo3.constants.php' - // ]); - - // register a single rule - // $rectorConfig->rule(\Ssch\TYPO3Rector\Rector\v9\v0\InjectAnnotationRector::class); - - /** - * Useful rule from RectorPHP itself to transform i.e. GeneralUtility::makeInstance('TYPO3\CMS\Core\Log\LogManager') - * to GeneralUtility::makeInstance(\TYPO3\CMS\Core\Log\LogManager::class) calls. - * But be warned, sometimes it produces false positives (edge cases), so watch out - */ - // $rectorConfig->rule(\Rector\Php55\Rector\String_\StringClassNameToClassConstantRector::class); - - // Optional non-php file functionalities: - // @see https://github.com/sabbelasichon/typo3-rector/blob/main/docs/beyond_php_file_processors.md - - // Rewrite your extbase persistence class mapping from typoscript into php according to official docs. - // This processor will create a summarized file with all the typoscript rewrites combined into a single file. - /* $rectorConfig->ruleWithConfiguration(\Ssch\TYPO3Rector\FileProcessor\TypoScript\Rector\v10\v0\ExtbasePersistenceTypoScriptRector::class, [ - \Ssch\TYPO3Rector\FileProcessor\TypoScript\Rector\v10\v0\ExtbasePersistenceTypoScriptRector::FILENAME => __DIR__ . '/packages/acme_demo/Configuration/Extbase/Persistence/Classes.php', - ]); */ - // Add some general TYPO3 rules - $rectorConfig->rule(ConvertImplicitVariablesToExplicitGlobalsRector::class); - $rectorConfig->ruleWithConfiguration(ExtEmConfRector::class, [ - ExtEmConfRector::ADDITIONAL_VALUES_TO_BE_REMOVED => [] + FirstClassCallableRector::class => [ + __DIR__ . '/Configuration/Services.php', + ], ]); - - // Modernize your TypoScript include statements for files and move from to @import use the FileIncludeToImportStatementVisitor (introduced with TYPO3 9.0) - // $rectorConfig->rule(\Ssch\TYPO3Rector\FileProcessor\TypoScript\Rector\v9\v0\FileIncludeToImportStatementTypoScriptRector::class); -};