From 8a19ab485715a2d13adf26b17aea6991b2a63a56 Mon Sep 17 00:00:00 2001
From: Hugo Alliaume
Date: Thu, 14 Aug 2025 22:58:41 +0200
Subject: [PATCH] Run latest PHP-CS-Fixer with improved configuration
---
.php-cs-fixer.dist.php | 3 +-
.../src/Maker/MakeAutocompleteField.php | 8 +-
src/Chartjs/tests/Kernel/TwigAppKernel.php | 2 +-
src/Cropperjs/tests/Kernel/AppKernelTrait.php | 2 +-
src/Dropzone/tests/Kernel/AppKernelTrait.php | 2 +-
src/Icons/src/Command/SearchIconCommand.php | 14 +-
.../Integration/RenderIconsInTwigTest.php | 24 +-
src/LazyImage/tests/BlurHash/BlurHashTest.php | 12 +-
src/LazyImage/tests/Kernel/AppKernelTrait.php | 2 +-
src/Map/tests/Kernel/AppKernelTrait.php | 2 +-
src/Notify/tests/Kernel/TwigAppKernel.php | 2 +-
.../ReactControllerLoaderAssetCompiler.php | 6 +-
src/React/tests/Kernel/TwigAppKernel.php | 2 +-
.../StimulusLoaderJavaScriptCompiler.php | 10 +-
.../src/Twig/UxControllersTwigRuntime.php | 2 +-
.../SvelteControllerLoaderAssetCompiler.php | 6 +-
src/Svelte/tests/Kernel/TwigAppKernel.php | 2 +-
.../tests/Kernel/TwigAppKernel.php | 2 +-
src/Toolkit/src/Command/CreateKitCommand.php | 34 +--
src/Toolkit/src/Command/DebugKitCommand.php | 12 +-
src/Toolkit/src/Command/InstallCommand.php | 16 +-
.../tests/Command/CreateKitCommandTest.php | 90 +++---
.../Functional/ComponentsRenderingTest.php | 18 +-
src/Toolkit/tests/Kit/KitManifestTest.php | 58 ++--
.../tests/Recipe/RecipeManifestTest.php | 182 ++++++------
src/Translator/src/TranslationsDumper.php | 6 +-
.../Functional/DumpEnabledLocalesTest.php | 20 +-
.../tests/Intl/IntlMessageParserTest.php | 48 +--
.../tests/Kernel/AppKernelTrait.php | 2 +-
.../IntlMessageParametersExtractorTest.php | 64 ++--
.../tests/TranslationsDumperTest.php | 96 +++---
.../src/Command/TwigComponentDebugCommand.php | 12 +-
.../Compiler/TwigComponentPass.php | 2 +-
.../Integration/ComponentExtensionTest.php | 104 +++----
.../tests/Unit/TwigPreLexerTest.php | 274 +++++++++---------
.../VueControllerLoaderAssetCompiler.php | 6 +-
src/Vue/tests/Kernel/TwigAppKernel.php | 2 +-
37 files changed, 575 insertions(+), 574 deletions(-)
diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php
index 35eb7c6c53d..1b6ae3e5fa9 100644
--- a/.php-cs-fixer.dist.php
+++ b/.php-cs-fixer.dist.php
@@ -30,7 +30,8 @@
return (new PhpCsFixer\Config())
->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect())
->setRules([
- '@PHPUnit75Migration:risky' => true,
+ '@PHP81Migration' => true, // take lowest version from `git grep -h '"php"' **/composer.json | uniq | sort`
+ '@PHPUnit91Migration:risky' => true,
'@Symfony' => true,
'@Symfony:risky' => true,
'protected_to_private' => false,
diff --git a/src/Autocomplete/src/Maker/MakeAutocompleteField.php b/src/Autocomplete/src/Maker/MakeAutocompleteField.php
index 1588b2cb22c..9bbdcba43d8 100644
--- a/src/Autocomplete/src/Maker/MakeAutocompleteField.php
+++ b/src/Autocomplete/src/Maker/MakeAutocompleteField.php
@@ -57,12 +57,12 @@ public function configureCommand(Command $command, InputConfiguration $inputConf
{
$command
->setHelp(<<%command.name% command generates an Ajax-autocomplete form field class for symfony/ux-autocomplete
+ The %command.name% command generates an Ajax-autocomplete form field class for symfony/ux-autocomplete
-php %command.full_name%
+ php %command.full_name%
-The command will ask you which entity the field is for and what to call your new class.
-EOF)
+ The command will ask you which entity the field is for and what to call your new class.
+ EOF)
;
}
diff --git a/src/Chartjs/tests/Kernel/TwigAppKernel.php b/src/Chartjs/tests/Kernel/TwigAppKernel.php
index 76de3dbd28c..9b69148ad8e 100644
--- a/src/Chartjs/tests/Kernel/TwigAppKernel.php
+++ b/src/Chartjs/tests/Kernel/TwigAppKernel.php
@@ -57,7 +57,7 @@ private function createTmpDir(string $type): string
$dir = sys_get_temp_dir().'/chartjs_bundle/'.uniqid($type.'_', true);
if (!file_exists($dir)) {
- mkdir($dir, 0777, true);
+ mkdir($dir, 0o777, true);
}
return $dir;
diff --git a/src/Cropperjs/tests/Kernel/AppKernelTrait.php b/src/Cropperjs/tests/Kernel/AppKernelTrait.php
index e0903a2f98a..5f0f0c2a40f 100644
--- a/src/Cropperjs/tests/Kernel/AppKernelTrait.php
+++ b/src/Cropperjs/tests/Kernel/AppKernelTrait.php
@@ -33,7 +33,7 @@ private function createTmpDir(string $type): string
$dir = sys_get_temp_dir().'/cropperjs_bundle/'.uniqid($type.'_', true);
if (!file_exists($dir)) {
- mkdir($dir, 0777, true);
+ mkdir($dir, 0o777, true);
}
return $dir;
diff --git a/src/Dropzone/tests/Kernel/AppKernelTrait.php b/src/Dropzone/tests/Kernel/AppKernelTrait.php
index 742980b54bb..795b0d25a16 100644
--- a/src/Dropzone/tests/Kernel/AppKernelTrait.php
+++ b/src/Dropzone/tests/Kernel/AppKernelTrait.php
@@ -33,7 +33,7 @@ private function createTmpDir(string $type): string
$dir = sys_get_temp_dir().'/dropzone_bundle/'.uniqid($type.'_', true);
if (!file_exists($dir)) {
- mkdir($dir, 0777, true);
+ mkdir($dir, 0o777, true);
}
return $dir;
diff --git a/src/Icons/src/Command/SearchIconCommand.php b/src/Icons/src/Command/SearchIconCommand.php
index f3ded32fd14..63ba817f13d 100644
--- a/src/Icons/src/Command/SearchIconCommand.php
+++ b/src/Icons/src/Command/SearchIconCommand.php
@@ -51,18 +51,18 @@ protected function configure(): void
->addArgument('name', InputArgument::OPTIONAL, 'Name of the icon (leave empty to search for sets)')
->setHelp(
<<%command.name% command search icon sets and icons from ux.symfony.com
+ The %command.name% command search icon sets and icons from ux.symfony.com
-To search for icon sets, pass the prefix or name of the icon set (or a part of it):
+ To search for icon sets, pass the prefix or name of the icon set (or a part of it):
- php %command.full_name% bootstrap
- php %command.full_name% material
+ php %command.full_name% bootstrap
+ php %command.full_name% material
-To search for icons, pass the prefix of the icon set and the name of the icon:
+ To search for icons, pass the prefix of the icon set and the name of the icon:
- php %command.full_name% bootstrap star
+ php %command.full_name% bootstrap star
-EOF
+ EOF
);
}
diff --git a/src/Icons/tests/Integration/RenderIconsInTwigTest.php b/src/Icons/tests/Integration/RenderIconsInTwigTest.php
index ad189bb9fbe..caca365c500 100644
--- a/src/Icons/tests/Integration/RenderIconsInTwigTest.php
+++ b/src/Icons/tests/Integration/RenderIconsInTwigTest.php
@@ -25,18 +25,18 @@ public function testRenderIcons()
$this->assertSame(
<<
-
-
-
-
-
-
-
-
-
-
- HTML,
+
+ HTML,
trim($output)
);
}
diff --git a/src/LazyImage/tests/BlurHash/BlurHashTest.php b/src/LazyImage/tests/BlurHash/BlurHashTest.php
index a5b6fcfc500..11b87a2cdbb 100644
--- a/src/LazyImage/tests/BlurHash/BlurHashTest.php
+++ b/src/LazyImage/tests/BlurHash/BlurHashTest.php
@@ -216,14 +216,14 @@ public function testTwigExtension()
if (BlurHash::intervention3()) {
$expected = <<
- {% endblock %}{% endcomponent %}
- EOF,
+ {% component 'Alert' %}
+ {% block content %}
+ {% embed "my_embed.html.twig" with { foo: 'bar' } %}{% endembed %}
+
+ {% endblock %}{% endcomponent %}
+ EOF,
];
yield 'component_where_entire_default_block_is_twig_embed_with_block_string' => [
<<
-
- {% embed "my_embed.html.twig" %}
- {% block my_embed_block "foo" %}
- {% endembed %}
-
-
- EOF,
+
+
+ {% embed "my_embed.html.twig" %}
+ {% block my_embed_block "foo" %}
+ {% endembed %}
+
+
+ EOF,
<<
- {% embed "my_embed.html.twig" %}
- {% block my_embed_block "foo" %}
- {% endembed %}
-
- {% endblock %}{% endcomponent %}
- EOF,
+ {% component 'Alert' %}
+ {% block content %}
+ {% embed "my_embed.html.twig" %}
+ {% block my_embed_block "foo" %}
+ {% endembed %}
+
+ {% endblock %}{% endcomponent %}
+ EOF,
];
yield 'component_where_entire_default_block_is_twig_embed_with_block_variable' => [
<<
-
- {% embed "my_embed.html.twig" %}
- {% block my_embed_block fooVar %}
- {% endembed %}
-
-
- EOF,
+
+
+ {% embed "my_embed.html.twig" %}
+ {% block my_embed_block fooVar %}
+ {% endembed %}
+
+
+ EOF,
<<
- {% embed "my_embed.html.twig" %}
- {% block my_embed_block fooVar %}
- {% endembed %}
-
- {% endblock %}{% endcomponent %}
- EOF,
+ {% component 'Alert' %}
+ {% block content %}
+ {% embed "my_embed.html.twig" %}
+ {% block my_embed_block fooVar %}
+ {% endembed %}
+
+ {% endblock %}{% endcomponent %}
+ EOF,
];
yield 'component_where_entire_default_block_is_twig_embed_with_block_expanded' => [
<<
-
- {% embed "my_embed.html.twig" %}
- {% block my_embed_block %}bar{% endblock %}
- {% endembed %}
-
-
- EOF,
+
+
+ {% embed "my_embed.html.twig" %}
+ {% block my_embed_block %}bar{% endblock %}
+ {% endembed %}
+
+
+ EOF,
<<
- {% embed "my_embed.html.twig" %}
- {% block my_embed_block %}bar{% endblock %}
- {% endembed %}
-
- {% endblock %}{% endcomponent %}
- EOF,
+ {% component 'Alert' %}
+ {% block content %}
+ {% embed "my_embed.html.twig" %}
+ {% block my_embed_block %}bar{% endblock %}
+ {% endembed %}
+
+ {% endblock %}{% endcomponent %}
+ EOF,
];
yield 'component_where_entire_default_block_is_twig_embed_with_block_variable_and_manipulations' => [
<<
-
- {% embed "my_embed.html.twig" %}
- {% block my_embed_block doSomething(fooVar)|u.camel.title.truncate(5) %}
- {% endembed %}
-
-
- EOF,
+
+
+ {% embed "my_embed.html.twig" %}
+ {% block my_embed_block doSomething(fooVar)|u.camel.title.truncate(5) %}
+ {% endembed %}
+
+
+ EOF,
<<
- {% embed "my_embed.html.twig" %}
- {% block my_embed_block doSomething(fooVar)|u.camel.title.truncate(5) %}
- {% endembed %}
-
- {% endblock %}{% endcomponent %}
- EOF,
+ {% component 'Alert' %}
+ {% block content %}
+ {% embed "my_embed.html.twig" %}
+ {% block my_embed_block doSomething(fooVar)|u.camel.title.truncate(5) %}
+ {% endembed %}
+
+ {% endblock %}{% endcomponent %}
+ EOF,
];
yield 'string_inside_of_twig_code_not_escaped' => [
<<
- EOF,
+
+ EOF,
<< [
@@ -382,59 +382,59 @@ public static function getLexTests(): iterable
];
yield 'component_with_comment_line_between_args' => [
<<
- TWIG,
+
+ TWIG,
'{{ component(\'foo\', { bar: \'baz\' }) }}',
];
yield 'component_with_comment_lines_between_args' => [
<<
- TWIG,
+
+ TWIG,
'{{ component(\'foo\', { foo: \'foo\', bar: \'bar\' }) }}',
];
yield 'component_with_comment_line_containing_ending_tag' => [
<<
- bar="bar"
- />
- TWIG,
+
+ bar="bar"
+ />
+ TWIG,
'{{ component(\'foo\', { bar: \'bar\' }) }}',
];
yield 'component_with_comment_line_in_argument_value' => [
<<
- TWIG,
+
+ TWIG,
'{{ component(\'foo\', { bar: \'# bar\' }) }}',
];
yield 'component_with_comment_line_in_argument_array_value_is_kept' => [
<<
- TWIG,
+
+ TWIG,
// Twig will remove the comment, we don't need to remove it
<<