From d6ae2fb7ca65f0a18e61aef0437c462602be09a3 Mon Sep 17 00:00:00 2001 From: dkranz Date: Fri, 11 Aug 2023 11:58:43 +0200 Subject: [PATCH] [TASK] Update GitHub CI workflow for correct php-cs-fixer version, code style fixes --- .github/workflows/ci.yaml | 2 +- Classes/Command/UpdateIpDatabaseCommand.php | 2 +- Tests/Functional/FrontendTest.php | 2 +- Tests/Functional/Store/Session/SessionStoreTest.php | 2 +- Tests/Functional/Utility/LocateUtilityTest.php | 4 ++-- composer.json | 6 ++++-- php-cs-fixer.php | 3 ++- 7 files changed, 12 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 750a696..6da1c71 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -20,7 +20,7 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php-version }} - tools: php-cs-fixer + tools: php-cs-fixer:3.14.1 - name: Check PHP CS run: php-cs-fixer fix --config php-cs-fixer.php --dry-run --using-cache no --show-progress dots -vvv diff --git a/Classes/Command/UpdateIpDatabaseCommand.php b/Classes/Command/UpdateIpDatabaseCommand.php index 819d11a..28fae7a 100644 --- a/Classes/Command/UpdateIpDatabaseCommand.php +++ b/Classes/Command/UpdateIpDatabaseCommand.php @@ -124,7 +124,7 @@ private function loadCsv(): array $data[] = [ 'ip_from' => $row[0], 'ip_to' => $row[1], - 'country_code' => $row[2] + 'country_code' => $row[2], ]; } diff --git a/Tests/Functional/FrontendTest.php b/Tests/Functional/FrontendTest.php index 54847d5..ed2e786 100644 --- a/Tests/Functional/FrontendTest.php +++ b/Tests/Functional/FrontendTest.php @@ -21,7 +21,7 @@ class FrontendTest extends FunctionalTestCase { protected array $testExtensionsToLoad = [ - 'typo3conf/ext/locate' + 'typo3conf/ext/locate', ]; protected function setUp(): void diff --git a/Tests/Functional/Store/Session/SessionStoreTest.php b/Tests/Functional/Store/Session/SessionStoreTest.php index a838d20..33246a6 100644 --- a/Tests/Functional/Store/Session/SessionStoreTest.php +++ b/Tests/Functional/Store/Session/SessionStoreTest.php @@ -22,7 +22,7 @@ class SessionStoreTest extends FunctionalTestCase protected $subject; protected array $testExtensionsToLoad = [ - 'typo3conf/ext/locate' + 'typo3conf/ext/locate', ]; protected function setUp(): void diff --git a/Tests/Functional/Utility/LocateUtilityTest.php b/Tests/Functional/Utility/LocateUtilityTest.php index 3ca9037..8bfecca 100644 --- a/Tests/Functional/Utility/LocateUtilityTest.php +++ b/Tests/Functional/Utility/LocateUtilityTest.php @@ -22,7 +22,7 @@ class LocateUtilityTest extends FunctionalTestCase protected $subject; protected array $testExtensionsToLoad = [ - 'typo3conf/ext/locate' + 'typo3conf/ext/locate', ]; protected function setUp(): void @@ -57,7 +57,7 @@ public function transformValuesTest() 'de-DE', 'de_DE', 'de_de', - 'de-de' + 'de-de', ]; foreach ($values as $value) { diff --git a/composer.json b/composer.json index 13c56b3..41bb40a 100644 --- a/composer.json +++ b/composer.json @@ -37,7 +37,8 @@ }, "require-dev": { "phpunit/phpunit": "^9.6", - "typo3/testing-framework": "^7.0" + "typo3/testing-framework": "^7.0", + "friendsofphp/php-cs-fixer": "v3.14.1" }, "suggest": { "jaybizzle/crawler-detect": "If you do not want to redirect bots.", @@ -72,7 +73,8 @@ "TYPO3\\TestingFramework\\Composer\\ExtensionTestEnvironment::prepare", "mkdir -p .Build/web/typo3conf/ext/", "[ -L .Build/web/typo3conf/ext/locate ] || ln -snvf ../../../../. .Build/web/typo3conf/ext/locate" - ] + ], + "cs-fix": ".Build/bin/php-cs-fixer fix --config php-cs-fixer.php --using-cache no --show-progress dots -v" }, "extra": { "typo3/cms": { diff --git a/php-cs-fixer.php b/php-cs-fixer.php index d15e400..9f08054 100644 --- a/php-cs-fixer.php +++ b/php-cs-fixer.php @@ -62,7 +62,7 @@ 'no_short_bool_cast' => true, 'no_singleline_whitespace_before_semicolons' => true, 'no_superfluous_elseif' => true, - 'no_trailing_comma_in_singleline_array' => true, + 'no_trailing_comma_in_singleline' => true, 'no_unneeded_control_parentheses' => true, 'no_unused_imports' => true, 'no_useless_else' => true, @@ -82,6 +82,7 @@ 'single_quote' => true, 'single_line_comment_style' => ['comment_types' => ['hash']], 'single_trait_insert_per_statement' => true, + 'trailing_comma_in_multiline' => ['elements' => ['arrays']], 'whitespace_after_comma_in_array' => true, ]) ->setFinder($finder);