From d4868680ed0a7322f011433df8b1ea972755ea28 Mon Sep 17 00:00:00 2001 From: Jan Rosier Date: Tue, 7 Oct 2025 21:01:57 +0200 Subject: [PATCH] [PHP CS Fixer] Update the config --- .php-cs-fixer.dist.php | 30 ++++++++----------- src/Command/AddUserCommand.php | 1 + src/DataFixtures/AppFixtures.php | 9 +++--- src/Entity/Comment.php | 1 + .../RedirectToPreferredLocaleSubscriber.php | 1 + .../TagArrayToStringTransformer.php | 1 + src/Repository/PostRepository.php | 1 + src/Twig/SourceCodeExtension.php | 1 + src/Utils/Validator.php | 1 + 9 files changed, 24 insertions(+), 22 deletions(-) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 74bde3ac1..5f6319423 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + $fileHeaderComment = <<in(__DIR__) - ->exclude('config') - ->exclude('var') - ->exclude('public/bundles') - ->exclude('public/build') - // exclude files generated by Symfony Flex recipes - ->notPath('public/index.php') - ->notPath('importmap.php') -; - return (new PhpCsFixer\Config()) + ->setFinder( + PhpCsFixer\Finder::create()->in(['src', 'tests'])->append([__FILE__]) + ) ->setRiskyAllowed(true) ->setRules([ '@Symfony' => true, '@Symfony:risky' => true, 'header_comment' => ['header' => $fileHeaderComment, 'separate' => 'both'], - 'linebreak_after_opening_tag' => true, - 'mb_str_functions' => true, - 'no_php4_constructor' => true, - 'no_unreachable_default_argument_value' => true, 'no_useless_else' => true, 'no_useless_return' => true, 'php_unit_strict' => true, - 'phpdoc_order' => true, 'strict_comparison' => true, 'strict_param' => true, - 'blank_line_between_import_groups' => false, ]) - ->setFinder($finder) ->setCacheFile(__DIR__.'/var/.php-cs-fixer.cache') ; diff --git a/src/Command/AddUserCommand.php b/src/Command/AddUserCommand.php index c9f4d53e6..129ee72a0 100644 --- a/src/Command/AddUserCommand.php +++ b/src/Command/AddUserCommand.php @@ -25,6 +25,7 @@ use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface; use Symfony\Component\Stopwatch\Stopwatch; + use function Symfony\Component\String\u; /** diff --git a/src/DataFixtures/AppFixtures.php b/src/DataFixtures/AppFixtures.php index d6f522aa0..4acc8b1ed 100644 --- a/src/DataFixtures/AppFixtures.php +++ b/src/DataFixtures/AppFixtures.php @@ -20,6 +20,7 @@ use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface; use Symfony\Component\String\AbstractUnicodeString; use Symfony\Component\String\Slugger\SluggerInterface; + use function Symfony\Component\String\u; final class AppFixtures extends Fixture @@ -127,9 +128,9 @@ private function getTagData(): array } /** - * @throws \Exception - * * @return array}> + * + * @throws \Exception */ private function getPostData(): array { @@ -245,9 +246,9 @@ private function getPostContent(): string } /** - * @throws \Exception - * * @return array + * + * @throws \Exception */ private function getRandomTags(): array { diff --git a/src/Entity/Comment.php b/src/Entity/Comment.php index fe8e80bdf..c54253611 100644 --- a/src/Entity/Comment.php +++ b/src/Entity/Comment.php @@ -14,6 +14,7 @@ use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; + use function Symfony\Component\String\u; /** diff --git a/src/EventSubscriber/RedirectToPreferredLocaleSubscriber.php b/src/EventSubscriber/RedirectToPreferredLocaleSubscriber.php index cda3ebede..abca9ac86 100644 --- a/src/EventSubscriber/RedirectToPreferredLocaleSubscriber.php +++ b/src/EventSubscriber/RedirectToPreferredLocaleSubscriber.php @@ -16,6 +16,7 @@ use Symfony\Component\HttpKernel\Event\RequestEvent; use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; + use function Symfony\Component\String\u; /** diff --git a/src/Form/DataTransformer/TagArrayToStringTransformer.php b/src/Form/DataTransformer/TagArrayToStringTransformer.php index 0226a17cf..6258e59e1 100644 --- a/src/Form/DataTransformer/TagArrayToStringTransformer.php +++ b/src/Form/DataTransformer/TagArrayToStringTransformer.php @@ -14,6 +14,7 @@ use App\Entity\Tag; use App\Repository\TagRepository; use Symfony\Component\Form\DataTransformerInterface; + use function Symfony\Component\String\u; /** diff --git a/src/Repository/PostRepository.php b/src/Repository/PostRepository.php index bef34dafc..0f949e097 100644 --- a/src/Repository/PostRepository.php +++ b/src/Repository/PostRepository.php @@ -16,6 +16,7 @@ use App\Pagination\Paginator; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Doctrine\Persistence\ManagerRegistry; + use function Symfony\Component\String\u; /** diff --git a/src/Twig/SourceCodeExtension.php b/src/Twig/SourceCodeExtension.php index 8865d193d..2f9e013b5 100644 --- a/src/Twig/SourceCodeExtension.php +++ b/src/Twig/SourceCodeExtension.php @@ -17,6 +17,7 @@ use Twig\Extension\AbstractExtension; use Twig\TemplateWrapper; use Twig\TwigFunction; + use function Symfony\Component\String\u; /** diff --git a/src/Utils/Validator.php b/src/Utils/Validator.php index def71a2a0..6acceaffc 100644 --- a/src/Utils/Validator.php +++ b/src/Utils/Validator.php @@ -12,6 +12,7 @@ namespace App\Utils; use Symfony\Component\Console\Exception\InvalidArgumentException; + use function Symfony\Component\String\u; /**