From a565d74139f54f3ebbc678f5e43043c6769cd6a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Uzna=C5=84ski?= Date: Thu, 20 Jul 2023 17:36:43 +0200 Subject: [PATCH] Update cs fixer (#631) --- .php-cs-fixer.php | 99 ++++--------------- Classes/ContentObject/JsonContentObject.php | 6 +- Classes/DataProcessing/GalleryProcessor.php | 6 +- .../RootSiteProcessing/DomainSchema.php | 2 +- Classes/DataProcessing/RootSitesProcessor.php | 2 +- Classes/Middleware/RedirectHandler.php | 2 +- Classes/Service/PaginationService.php | 8 +- Classes/Utility/FileUtility.php | 2 +- Classes/Utility/UrlUtility.php | 5 +- .../Iterator/ExplodeViewHelper.php | 2 +- Configuration/RequestMiddlewares.php | 14 +-- .../SiteConfiguration/Overrides/site.php | 2 +- .../Overrides/site_base_variant.php | 2 +- Tests/Functional/BaseTest.php | 8 +- .../PageTypes/BasePageTypesTest.php | 2 +- .../DataProcessingTraitTest.php | 20 ++-- .../RootSiteProcessing/DomainSchemaTest.php | 12 +-- .../RootSiteProcessing/TestDomainSchema.php | 2 +- .../DataProcessing/RootSitesProcessorTest.php | 8 +- Tests/Unit/Event/EnrichFileDataEventTest.php | 2 +- ...edirectUrlAdditionalParamsListenerTest.php | 16 +-- Tests/Unit/Event/RedirectUrlEventTest.php | 2 +- .../AbstractFormDefinitionDecoratorTest.php | 16 +-- Tests/Unit/Form/TranslatorTest.php | 16 +-- Tests/Unit/Hooks/HeadlessUserIntTest.php | 14 +-- Tests/Unit/Json/JsonDecoderTest.php | 2 +- .../Middleware/CookieDomainPerSiteTest.php | 8 +- .../ElementBodyResponseMiddlewareTest.php | 2 +- .../ShortcutAndMountPointRedirectTest.php | 6 +- Tests/Unit/Utility/FileUtilityTest.php | 10 +- Tests/Unit/Utility/UrlUtilityTest.php | 68 ++++++------- composer.json | 10 +- 32 files changed, 159 insertions(+), 217 deletions(-) diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index 671b46a1..52eeb886 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -1,9 +1,5 @@ setRiskyAllowed(true) - ->setRules( - [ - '@DoctrineAnnotation' => true, - '@PSR12' => true, - 'array_syntax' => ['syntax' => 'short'], - 'blank_line_after_opening_tag' => true, - 'braces' => ['allow_single_line_closure' => true], - 'cast_spaces' => ['space' => 'none'], - 'compact_nullable_typehint' => true, - 'concat_space' => ['spacing' => 'one'], - 'declare_equal_normalize' => ['space' => 'none'], - 'dir_constant' => true, - 'function_typehint_space' => true, - 'general_phpdoc_annotation_remove' => ['annotations' => ['author']], - 'lowercase_cast' => true, - 'method_argument_space' => ['on_multiline' => 'ensure_fully_multiline'], - 'modernize_types_casting' => true, - 'native_function_casing' => true, - 'new_with_braces' => true, - 'no_alias_functions' => true, - 'no_blank_lines_after_phpdoc' => true, - 'no_empty_phpdoc' => true, - 'no_empty_statement' => true, - 'no_extra_blank_lines' => true, - 'no_leading_import_slash' => true, - 'no_leading_namespace_whitespace' => true, - 'no_null_property_initialization' => true, - 'no_short_bool_cast' => true, - 'no_singleline_whitespace_before_semicolons' => true, - 'no_superfluous_elseif' => true, - 'no_trailing_comma_in_singleline' => true, - 'no_unneeded_control_parentheses' => true, - 'no_unused_imports' => true, - 'no_useless_else' => true, - 'no_whitespace_in_blank_line' => true, - 'ordered_imports' => [ - 'imports_order' => [ - 'class', - 'function', - 'const', - ], - 'sort_algorithm' => 'alpha', - ], - 'php_unit_construct' => ['assertions' => ['assertEquals', 'assertSame', 'assertNotEquals', 'assertNotSame']], - 'php_unit_mock_short_will_return' => true, - 'php_unit_test_case_static_method_calls' => ['call_type' => 'self'], - 'phpdoc_no_access' => true, - 'phpdoc_no_empty_return' => true, - 'phpdoc_no_package' => true, - 'phpdoc_scalar' => true, - 'phpdoc_trim' => true, - 'phpdoc_types' => true, - 'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'], - 'return_type_declaration' => ['space_before' => 'none'], - 'single_line_comment_style' => ['comment_types' => ['hash']], - 'single_quote' => true, - 'single_trait_insert_per_statement' => true, - 'whitespace_after_comma_in_array' => true, - 'header_comment' => [ - 'header' => $header, - 'comment_type' => 'comment', - 'location' => 'after_open', - 'separate' => 'both' - ], - ] - ) - ->setFinder( - PhpCsFixer\Finder::create() - ->exclude('.build') - ->exclude('var') - ->exclude('public') - ->in(__DIR__) - ); +$config = \TYPO3\CodingStandards\CsFixerConfig::create(); +$config->getFinder()->in('Classes')->in('Configuration')->in('Tests'); +$rules = $config->getRules(); +$rules['ordered_imports'] = [ + 'imports_order' => [ + 'class', + 'function', + 'const', + ], + 'sort_algorithm' => 'alpha', +]; +$rules['header_comment'] = [ + 'header' => $header, + 'comment_type' => 'comment', + 'location' => 'after_open', + 'separate' => 'both' +]; + +$config->setRules($rules); +return $config; \ No newline at end of file diff --git a/Classes/ContentObject/JsonContentObject.php b/Classes/ContentObject/JsonContentObject.php index a811d3f2..a63e9674 100755 --- a/Classes/ContentObject/JsonContentObject.php +++ b/Classes/ContentObject/JsonContentObject.php @@ -98,7 +98,7 @@ public function cObjGet(array $setup, string $addKey = ''): array $sKeyArray = $this->filterByStringKeys($setup); foreach ($sKeyArray as $theKey) { $theValue = $setup[$theKey]; - if ((string)$theKey && strpos($theKey, '.') === false) { + if ((string)$theKey && !str_contains($theKey, '.')) { $conf = $setup[$theKey . '.'] ?? []; $contentDataProcessing['dataProcessing.'] = $conf['dataProcessing.'] ?? []; $content[$theKey] = $this->cObj->cObjGetSingle($theValue, $conf, $addKey . $theKey); @@ -111,7 +111,7 @@ public function cObjGet(array $setup, string $addKey = ''): array if ((isset($conf['boolval']) && $conf['boolval']) || $theValue === 'BOOL') { $content[$theKey] = (bool)(int)$content[$theKey]; } - if ($theValue === 'USER_INT' || strpos((string)$content[$theKey], '