Skip to content

Commit

Permalink
TASK: Apply ecs for more files
Browse files Browse the repository at this point in the history
  • Loading branch information
sabbelasichon committed Dec 20, 2022
1 parent dba320d commit 8912d89
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 30 deletions.
42 changes: 26 additions & 16 deletions ecs.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,54 @@

declare(strict_types=1);

/*
* This file is part of the "typo3_encore" Extension for TYPO3 CMS.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*/

use PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer;
use PhpCsFixer\Fixer\Comment\HeaderCommentFixer;
use PhpCsFixer\Fixer\ControlStructure\YodaStyleFixer;
use PhpCsFixer\Fixer\Phpdoc\GeneralPhpdocAnnotationRemoveFixer;
use PhpCsFixer\Fixer\Phpdoc\NoSuperfluousPhpdocTagsFixer;
use PhpCsFixer\Fixer\Strict\DeclareStrictTypesFixer;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\CodingStandard\Fixer\ArrayNotation\ArrayOpenerAndCloserNewlineFixer;
use Symplify\CodingStandard\Fixer\ArrayNotation\StandaloneLineInMultilineArrayFixer;
use Symplify\CodingStandard\Fixer\LineLength\LineLengthFixer;
use Symplify\EasyCodingStandard\Config\ECSConfig;
use Symplify\EasyCodingStandard\ValueObject\Option;
use Symplify\EasyCodingStandard\ValueObject\Set\SetList;

return static function (ECSConfig $config): void {

$header = <<<EOF
$header = <<<CODE_SAMPLE
This file is part of the "typo3_encore" Extension for TYPO3 CMS.
For the full copyright and license information, please read the
LICENSE.txt file that was distributed with this source code.
EOF;
CODE_SAMPLE;

$config->paths([
__DIR__.'/Classes',
__DIR__.'/Configuration',
__DIR__.'/Tests',
__DIR__ . '/Classes',
__DIR__ . '/Configuration',
__DIR__ . '/Tests',
__DIR__ . '/rector.php',
__DIR__ . '/ecs.php',
__DIR__ . '/ext_localconf.php',
]);

$config->skip([
DeclareStrictTypesFixer::class => [__DIR__ . '/ext_localconf.php'],
HeaderCommentFixer::class => [__DIR__ . '/ext_localconf.php'],
]);

$config->ruleWithConfiguration(ArraySyntaxFixer::class, [
'syntax' => 'short'
'syntax' => 'short',
]);
$config->ruleWithConfiguration(HeaderCommentFixer::class, [
'header' => $header,
'separate' => 'both',
]);
$config->ruleWithConfiguration(HeaderCommentFixer::class, ['header' => $header, 'separate' => 'both']);

$config->rule(StandaloneLineInMultilineArrayFixer::class);
$config->rule(ArrayOpenerAndCloserNewlineFixer::class);
Expand All @@ -47,12 +62,7 @@
'allow_mixed' => true,
]);

$config->sets([
SetList::PSR_12,
SetList::SYMPLIFY,
SetList::COMMON,
SetList::CLEAN_CODE
]);
$config->sets([SetList::PSR_12, SetList::SYMPLIFY, SetList::COMMON, SetList::CLEAN_CODE]);
$config->rule(DeclareStrictTypesFixer::class);
$config->rule(LineLengthFixer::class);
$config->rule(YodaStyleFixer::class);
Expand Down
7 changes: 2 additions & 5 deletions ext_localconf.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
<?php

call_user_func(static function ($packageKey) {

$GLOBALS['TYPO3_CONF_VARS']['FE']['addAllowedPaths'] .= ',' . $packageKey;

// Enable for Frontend and Backend at the same time
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_pagerenderer.php']['render-preProcess'][$packageKey] = \Ssch\Typo3Encore\Integration\PageRendererHooks::class . '->renderPreProcess';
// Add collected assets to page cache
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['contentPostProc-all'][$packageKey] = \Ssch\Typo3Encore\Integration\TypoScriptFrontendControllerHooks::class . '->contentPostProcAll';
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['contentPostProc-all'][$packageKey] = \Ssch\Typo3Encore\Integration\TypoScriptFrontendControllerHooks::class . '->contentPostProcAll';
}, 'typo3_encore');

$GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['formDataGroup']['tcaDatabaseRecord'][\Ssch\Typo3Encore\Form\FormDataProvider\RichtextEncoreConfiguration::class] = [
'depends' => [
\TYPO3\CMS\Backend\Form\FormDataProvider\TcaText::class,
],
'depends' => [\TYPO3\CMS\Backend\Form\FormDataProvider\TcaText::class],
];
18 changes: 9 additions & 9 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@

declare(strict_types=1);

use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
/*
* This file is part of the "typo3_encore" Extension for TYPO3 CMS.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*/

use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\LevelSetList;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->paths([
__DIR__.'/Classes',
__DIR__.'/Configuration',
__DIR__.'/Tests',
]);
$rectorConfig->paths([__DIR__ . '/Classes', __DIR__ . '/Configuration', __DIR__ . '/Tests']);

// define sets of rules
$rectorConfig->sets([
LevelSetList::UP_TO_PHP_74,
]);
$rectorConfig->sets([LevelSetList::UP_TO_PHP_74]);
};

0 comments on commit 8912d89

Please sign in to comment.