From 5b47ed3e3b74bd39fb26b98392033fa41edaca38 Mon Sep 17 00:00:00 2001 From: Matthias Pigulla Date: Tue, 27 Aug 2024 09:14:02 +0200 Subject: [PATCH] Use Docker image provided by friendsofphp/php-cs-fixer (#74) --- .github/workflows/fix-cs-php.yml | 4 +++- .php-cs-fixer.dist.php | 2 ++ src/Doctrine/PersistentTranslatable.php | 4 ++-- src/Doctrine/TranslatableClassMetadata.php | 4 ++-- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/fix-cs-php.yml b/.github/workflows/fix-cs-php.yml index a5d933c..e4f795f 100644 --- a/.github/workflows/fix-cs-php.yml +++ b/.github/workflows/fix-cs-php.yml @@ -21,7 +21,9 @@ jobs: ref: ${{ github.head_ref }} - name: Run PHP-CS-Fixer - uses: docker://oskarstark/php-cs-fixer-ga + uses: docker://ghcr.io/php-cs-fixer/php-cs-fixer:3.62.0-php8.3 + with: + args: "fix --show-progress=dots" - name: Commit and push back changes uses: stefanzweifel/git-auto-commit-action@v5 diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 35ba6ce..f3d74bc 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -1,8 +1,10 @@ setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect()) ->setRules([ '@Symfony' => true, + 'phpdoc_separation' => false, '@Symfony:risky' => true, 'array_syntax' => array('syntax' => 'short'), 'no_unreachable_default_argument_value' => false, diff --git a/src/Doctrine/PersistentTranslatable.php b/src/Doctrine/PersistentTranslatable.php index 35acda8..309d303 100644 --- a/src/Doctrine/PersistentTranslatable.php +++ b/src/Doctrine/PersistentTranslatable.php @@ -192,7 +192,7 @@ public function translate(?string $locale = null): mixed return $this->primaryValue; } catch (Exception $e) { - $message = sprintf( + $message = \sprintf( 'Cannot translate property %s::%s into locale %s', \get_class($this->entity), $this->translationProperty->getName(), @@ -271,7 +271,7 @@ private function stringifyException(Throwable $e): string if (!empty($exceptionAsString)) { $exceptionAsString .= \PHP_EOL.'Previous exception: '.\PHP_EOL; } - $exceptionAsString .= sprintf( + $exceptionAsString .= \sprintf( "Exception '%s' with message '%s' in %s:%d\n%s", $e::class, $e->getMessage(), diff --git a/src/Doctrine/TranslatableClassMetadata.php b/src/Doctrine/TranslatableClassMetadata.php index 2f5bec7..41b56df 100644 --- a/src/Doctrine/TranslatableClassMetadata.php +++ b/src/Doctrine/TranslatableClassMetadata.php @@ -159,7 +159,7 @@ private function isClassWithoutTranslations(): bool private function assertAttributesAreComplete(string $class): void { if (null === $this->translationClass) { - throw new RuntimeException(sprintf('Unable to find the translations for %s. There should be a one-to-may collection holding the translation entities, and it should be marked with %s.', $class, Attribute\TranslationCollection::class)); + throw new RuntimeException(\sprintf('Unable to find the translations for %s. There should be a one-to-may collection holding the translation entities, and it should be marked with %s.', $class, Attribute\TranslationCollection::class)); } if (null === $this->translationLocaleProperty) { @@ -175,7 +175,7 @@ private function assertAttributesAreComplete(string $class): void } if (null === $this->primaryLocale) { - throw new RuntimeException(sprintf('Class %s uses translations, so it needs to provide the primary locale with the %s attribute at the class level. This can either be at the class itself, or in one of its parent classes.', $class, Attribute\Locale::class)); + throw new RuntimeException(\sprintf('Class %s uses translations, so it needs to provide the primary locale with the %s attribute at the class level. This can either be at the class itself, or in one of its parent classes.', $class, Attribute\Locale::class)); } }