Skip to content

Commit b150af3

Browse files
committed
Homogenize PHP-CS-Fixer configuration with symfony/symfony, and run it
1 parent f26124c commit b150af3

File tree

9 files changed

+20
-16
lines changed

9 files changed

+20
-16
lines changed

.php-cs-fixer.dist.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
* file that was distributed with this source code.
1010
*/
1111

12+
use Symfony\UX\LiveComponent\Attribute\LiveProp;
13+
1214
if (!file_exists(__DIR__.'/src')) {
1315
exit(0);
1416
}
@@ -28,8 +30,20 @@
2830
'@PHPUnit75Migration:risky' => true,
2931
'@Symfony' => true,
3032
'@Symfony:risky' => true,
33+
'protected_to_private' => false,
34+
'no_superfluous_phpdoc_tags' => [
35+
'remove_inheritdoc' => true,
36+
'allow_unused_params' => true, // for future-ready params, to be replaced with https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/7377
37+
],
3138
'header_comment' => ['header' => $fileHeaderComment],
32-
'trailing_comma_in_multiline' => ['elements' => ['arrays', 'match', 'parameters']],
39+
// TODO: Remove once the "compiler_optimized" set includes "sprintf"
40+
'native_function_invocation' => ['include' => ['@compiler_optimized', 'sprintf'], 'scope' => 'namespaced', 'strict' => true],
41+
'nullable_type_declaration' => true,
42+
'nullable_type_declaration_for_default_null_value' => true,
43+
'modernize_strpos' => true,
44+
'get_class_to_class_keyword' => true,
45+
// It breaks \Symfony\UX\LiveComponent\Tests\Integration\LiveComponentHydratorTest when modifying the PHPDoc of `#[LiveProp]` from anonymous class properties
46+
'fully_qualified_strict_types' => false,
3347
])
3448
->setRiskyAllowed(true)
3549
->setFinder(

src/Icons/config/twig_component.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
1313

1414
use Symfony\UX\Icons\Twig\UXIconComponent;
15-
use Symfony\UX\Icons\Twig\UXIconComponentListener;
1615

1716
return static function (ContainerConfigurator $container): void {
1817
$container->services()

src/LiveComponent/src/Util/LiveAttributesCollection.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@
1111

1212
namespace Symfony\UX\LiveComponent\Util;
1313

14-
use Twig\Environment;
15-
use Twig\Extension\EscaperExtension;
16-
use Twig\Runtime\EscaperRuntime;
17-
1814
/**
1915
* A collection of HTML attributes useful for LiveComponent.
2016
*

src/LiveComponent/src/Util/TwigAttributeHelperFactory.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111

1212
namespace Symfony\UX\LiveComponent\Util;
1313

14-
use Twig\Environment;
15-
1614
/**
1715
* Helper for building an array of attributes for the live controller element.
1816
*

src/LiveComponent/tests/Functional/EventListener/LiveComponentSubscriberTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
namespace Symfony\UX\LiveComponent\Tests\Functional\EventListener;
1313

1414
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
15-
use Symfony\Component\DomCrawler\Crawler;
16-
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
1715
use Symfony\Component\Security\Core\User\InMemoryUser;
1816
use Symfony\Component\Security\Http\Attribute\IsGranted;
1917
use Symfony\UX\LiveComponent\Tests\Fixtures\Entity\Entity1;

src/LiveComponent/tests/Integration/EventListener/DataModelPropsSubscriberTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\UX\LiveComponent\Tests\Integration\EventListener;
1313

1414
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
15-
use Symfony\Component\HttpFoundation\Request;
1615
use Symfony\UX\LiveComponent\Tests\LiveComponentTestHelper;
1716
use Symfony\UX\TwigComponent\ComponentRenderer;
1817

src/LiveComponent/tests/Integration/LiveComponentHydratorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -941,7 +941,7 @@ public function mount()
941941
yield 'Object: (de)hydrates correctly array of DTO' => [function () {
942942
return HydrationTest::create(new class {
943943
/**
944-
* @var Symfony\UX\LiveComponent\Tests\Fixtures\Dto\CustomerDetails[] $customerDetailsCollection
944+
* @var \Symfony\UX\LiveComponent\Tests\Fixtures\Dto\CustomerDetails[] $customerDetailsCollection
945945
*/
946946
#[LiveProp(writable: true)]
947947
public array $customerDetailsCollection = [];

src/Toolkit/src/Command/InstallComponentCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
123123
} else {
124124
$io->error(null === $componentName
125125
? 'It seems that no local kits are available and it should not happens. Please open an issue on https://github.com/symfony/ux to report this.'
126-
: sprintf("The component \"%s\" does not exist in any local kits.\n\nYou can try to run one of the following commands to interactively install components:\n%s\n\nOr you can try one of the community kits https://github.com/search?q=topic:ux-toolkit&type=repositories", $componentName, implode("\n", array_map(fn (string $availableKitName) => sprintf('$ bin/console %s --kit %s', $this->getName(), $availableKitName), $availableKitNames)))
126+
: \sprintf("The component \"%s\" does not exist in any local kits.\n\nYou can try to run one of the following commands to interactively install components:\n%s\n\nOr you can try one of the community kits https://github.com/search?q=topic:ux-toolkit&type=repositories", $componentName, implode("\n", array_map(fn (string $availableKitName) => \sprintf('$ bin/console %s --kit %s', $this->getName(), $availableKitName), $availableKitNames)))
127127
);
128128

129129
return Command::FAILURE;

src/TwigComponent/tests/Unit/TwigPreLexerTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ public static function getLexTests(): iterable
168168
{% component 'foo' %}
169169
{% block content %}{% component 'bar' %}{% block content %}bar content{% endblock %}{% endcomponent %}
170170
{% endblock %}{% endcomponent %}
171-
EOF
171+
EOF,
172172
];
173173
yield 'component_where_entire_default_block_is_embedded_component_self_closing' => [
174174
<<<EOF
@@ -180,7 +180,7 @@ public static function getLexTests(): iterable
180180
{% component 'foo' %}
181181
{% block content %}{{ component('bar') }}
182182
{% endblock %}{% endcomponent %}
183-
EOF
183+
EOF,
184184
];
185185

186186
yield 'component_where_entire_default_block_is_twig_embed' => [
@@ -293,7 +293,7 @@ public static function getLexTests(): iterable
293293
'src/Twig/MealPlanner.php',
294294
'templates/components/MealPlanner.html.twig',
295295
] }) }}
296-
EOF
296+
EOF,
297297
];
298298

299299
yield 'component_with_dashed_attribute' => [

0 commit comments

Comments
 (0)