Skip to content

Homogenize PHP-CS-Fixer configuration with symfony/symfony, and run it #2768

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: 2.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,18 @@
'@PHPUnit75Migration:risky' => true,
'@Symfony' => true,
'@Symfony:risky' => true,
'protected_to_private' => false,
'no_superfluous_phpdoc_tags' => [
'remove_inheritdoc' => true,
'allow_unused_params' => true, // for future-ready params, to be replaced with https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/7377
],
'header_comment' => ['header' => $fileHeaderComment],
'trailing_comma_in_multiline' => ['elements' => ['arrays', 'match', 'parameters']],
// TODO: Remove once the "compiler_optimized" set includes "sprintf"
'native_function_invocation' => ['include' => ['@compiler_optimized', 'sprintf'], 'scope' => 'namespaced', 'strict' => true],
'nullable_type_declaration' => true,
'nullable_type_declaration_for_default_null_value' => true,
'modernize_strpos' => true,
'get_class_to_class_keyword' => true,
])
->setRiskyAllowed(true)
->setFinder(
Expand Down
1 change: 0 additions & 1 deletion src/Icons/config/twig_component.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
namespace Symfony\Component\DependencyInjection\Loader\Configurator;

use Symfony\UX\Icons\Twig\UXIconComponent;
use Symfony\UX\Icons\Twig\UXIconComponentListener;

return static function (ContainerConfigurator $container): void {
$container->services()
Expand Down
4 changes: 0 additions & 4 deletions src/LiveComponent/src/Util/LiveAttributesCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@

namespace Symfony\UX\LiveComponent\Util;

use Twig\Environment;
use Twig\Extension\EscaperExtension;
use Twig\Runtime\EscaperRuntime;

/**
* A collection of HTML attributes useful for LiveComponent.
*
Expand Down
2 changes: 0 additions & 2 deletions src/LiveComponent/src/Util/TwigAttributeHelperFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

namespace Symfony\UX\LiveComponent\Util;

use Twig\Environment;

/**
* Helper for building an array of attributes for the live controller element.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
namespace Symfony\UX\LiveComponent\Tests\Functional\EventListener;

use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\DomCrawler\Crawler;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Symfony\Component\Security\Core\User\InMemoryUser;
use Symfony\Component\Security\Http\Attribute\IsGranted;
use Symfony\UX\LiveComponent\Tests\Fixtures\Entity\Entity1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
namespace Symfony\UX\LiveComponent\Tests\Integration\EventListener;

use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\HttpFoundation\Request;
use Symfony\UX\LiveComponent\Tests\LiveComponentTestHelper;
use Symfony\UX\TwigComponent\ComponentRenderer;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,7 @@ public function mount()

return HydrationTest::create(new class {
/**
* @var \Symfony\UX\LiveComponent\Tests\Fixtures\Dto\Address[]
* @var Address[]
*/
#[LiveProp(writable: true, useSerializerForHydration: true)]
public array $addresses = [];
Expand Down Expand Up @@ -1017,7 +1017,7 @@ public function mount()

return HydrationTest::create(new class {
/**
* @var \Symfony\UX\LiveComponent\Tests\Fixtures\Dto\Address[]
* @var Address[]
*/
#[LiveProp(writable: true, useSerializerForHydration: true)]
public array $addresses = [];
Expand Down Expand Up @@ -1045,7 +1045,7 @@ public function mount()
yield 'Array with DTOs: fully writable allows deep partial changes' => [function () {
return HydrationTest::create(new class {
/**
* @var \Symfony\UX\LiveComponent\Tests\Fixtures\Dto\HoldsArrayOfDtos[] $dtos
* @var HoldsArrayOfDtos[] $dtos
*/
#[LiveProp(writable: true, useSerializerForHydration: true)]
public array $dtos = [];
Expand Down Expand Up @@ -1165,7 +1165,7 @@ public function mount()

yield 'Collection: using serializer (de)hydrates correctly' => [function () {
return HydrationTest::create(new class {
/** @var \Symfony\UX\LiveComponent\Tests\Fixtures\Dto\Temperature[] */
/** @var Temperature[] */
#[LiveProp(useSerializerForHydration: true)]
public array $temperatures = [];

Expand Down
2 changes: 1 addition & 1 deletion src/Toolkit/src/Command/InstallComponentCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
} else {
$io->error(null === $componentName
? '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.'
: 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)))
: \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)))
);

return Command::FAILURE;
Expand Down
6 changes: 3 additions & 3 deletions src/TwigComponent/tests/Unit/TwigPreLexerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public static function getLexTests(): iterable
{% component 'foo' %}
{% block content %}{% component 'bar' %}{% block content %}bar content{% endblock %}{% endcomponent %}
{% endblock %}{% endcomponent %}
EOF
EOF,
];
yield 'component_where_entire_default_block_is_embedded_component_self_closing' => [
<<<EOF
Expand All @@ -180,7 +180,7 @@ public static function getLexTests(): iterable
{% component 'foo' %}
{% block content %}{{ component('bar') }}
{% endblock %}{% endcomponent %}
EOF
EOF,
];

yield 'component_where_entire_default_block_is_twig_embed' => [
Expand Down Expand Up @@ -293,7 +293,7 @@ public static function getLexTests(): iterable
'src/Twig/MealPlanner.php',
'templates/components/MealPlanner.html.twig',
] }) }}
EOF
EOF,
];

yield 'component_with_dashed_attribute' => [
Expand Down
Loading