Skip to content

Commit

Permalink
minor #2077 [CI] Update php-cs-fixer config (smnandre)
Browse files Browse the repository at this point in the history
This PR was squashed before being merged into the 2.x branch.

Discussion
----------

[CI] Update php-cs-fixer config

* Update phh-cs-fixer version
* Follow symfony/symfony configuration (#57941)
* Apply new rules

Commits
-------

09597b3 [CI] Update php-cs-fixer config
  • Loading branch information
kbond committed Aug 20, 2024
2 parents 70c68d8 + 09597b3 commit 09cc7d0
Show file tree
Hide file tree
Showing 14 changed files with 82 additions and 89 deletions.
2 changes: 0 additions & 2 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
'@Symfony' => true,
'@Symfony:risky' => true,
'header_comment' => ['header' => $fileHeaderComment],
// TODO: Remove once the "compiler_optimized" set includes "sprintf"
'native_function_invocation' => ['include' => ['@compiler_optimized', 'sprintf'], 'scope' => 'namespaced', 'strict' => true],
'trailing_comma_in_multiline' => ['elements' => ['arrays', 'match', 'parameters']],
])
->setRiskyAllowed(true)
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
"require-dev": {
"symfony/filesystem": "^5.2|^6.0|^7.0",
"symfony/finder": "^5.4|^6.0|^7.0",
"php-cs-fixer/shim": "^3.13"
"php-cs-fixer/shim": "^3.62"
}
}
118 changes: 59 additions & 59 deletions src/LiveComponent/tests/Integration/LiveComponentHydratorTest.php

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ final class AsLiveComponentTest extends TestCase
public function testPreDehydrateMethodsAreOrderedByPriority(): void
{
$hooks = AsLiveComponent::preDehydrateMethods(
new class() {
new class {
#[PreDehydrate(priority: -10)]
public function hook1()
{
Expand All @@ -56,7 +56,7 @@ public function hook3()
public function testPostHydrateMethodsAreOrderedByPriority(): void
{
$hooks = AsLiveComponent::postHydrateMethods(
new class() {
new class {
#[PostHydrate(priority: -10)]
public function hook1()
{
Expand All @@ -83,7 +83,7 @@ public function hook3()
public function testPreMountHooksAreOrderedByPriority(): void
{
$hooks = AsLiveComponent::preReRenderMethods(
new class() {
new class {
#[PreReRender(priority: -10)]
public function hook1()
{
Expand Down
6 changes: 3 additions & 3 deletions src/LiveComponent/tests/Unit/Attribute/LivePropTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ public function testDehydrateWithMethod(): void

public function testCanCallCalculateFieldNameAsString(): void
{
$component = new class() {};
$component = new class {};

$this->assertSame('field', (new LiveProp(false, null, null, false, [], 'field'))->calculateFieldName($component, 'fallback'));
}

public function testCanCallCalculateFieldNameAsMethod(): void
{
$component = new class() {
$component = new class {
public function fieldName(): string
{
return 'foo';
Expand All @@ -52,7 +52,7 @@ public function fieldName(): string

public function testCanCallCalculateFieldNameWhenNotSet(): void
{
$component = new class() {};
$component = new class {};

$this->assertSame('fallback', (new LiveProp())->calculateFieldName($component, 'fallback'));
}
Expand Down
2 changes: 1 addition & 1 deletion src/Map/tests/MapTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function testWithMaximumConfiguration(): void
->center(new Point(48.8566, 2.3522))
->zoom(6)
->fitBoundsToMarkers()
->options(new class() implements MapOptionsInterface {
->options(new class implements MapOptionsInterface {
public function toArray(): array
{
return [
Expand Down
2 changes: 1 addition & 1 deletion src/Turbo/src/TurboBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function build(ContainerBuilder $container): void
{
parent::build($container);

$container->addCompilerPass(new class() implements CompilerPassInterface {
$container->addCompilerPass(new class implements CompilerPassInterface {
public function process(ContainerBuilder $container): void
{
if (!$container->hasDefinition('turbo.broadcaster.imux')) {
Expand Down
2 changes: 0 additions & 2 deletions src/TwigComponent/src/Attribute/AsTwigComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ public function serviceConfig(): array
/**
* @param object|class-string $component
*
* @return ?\ReflectionMethod
*
* @internal
*/
public static function mountMethod(object|string $component): ?\ReflectionMethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function testExceptionThrownIfRequiredMountParameterIsMissingFromPassedDa

public function testStringableObjectCanBePassedToComponent(): void
{
$attributes = $this->factory()->create('component_a', ['propB' => 'B', 'data-item-id-param' => new class() {
$attributes = $this->factory()->create('component_a', ['propB' => 'B', 'data-item-id-param' => new class {
public function __toString(): string
{
return 'test';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ final class AsTwigComponentTest extends TestCase
public function testPreMountHooksAreOrderedByPriority(): void
{
$hooks = AsTwigComponent::preMountMethods(
new class() {
new class {
#[PreMount(priority: -10)]
public function hook1()
{
Expand All @@ -51,7 +51,7 @@ public function hook3()
public function testPostMountHooksAreOrderedByPriority(): void
{
$hooks = AsTwigComponent::postMountMethods(
new class() {
new class {
#[PostMount(priority: -10)]
public function hook1()
{
Expand Down
4 changes: 2 additions & 2 deletions src/TwigComponent/tests/Unit/ComponentAttributesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function testCanConvertToString(): void
{
$attributes = new ComponentAttributes([
'class' => 'foo',
'style' => new class() {
'style' => new class {
public function __toString(): string
{
return 'color:black;';
Expand Down Expand Up @@ -216,7 +216,7 @@ public function testRenderSingleAttribute(): void
public function testRenderingSingleAttributeExcludesFromString(): void
{
$attributes = new ComponentAttributes([
'attr1' => new class() {
'attr1' => new class {
public function __toString(): string
{
return 'value1';
Expand Down
16 changes: 8 additions & 8 deletions src/TwigComponent/tests/Unit/ComputedPropertiesProxyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ final class ComputedPropertiesProxyTest extends TestCase
{
public function testProxyCachesGetMethodReturns(): void
{
$proxy = new ComputedPropertiesProxy(new class() {
$proxy = new ComputedPropertiesProxy(new class {
private int $count = 0;

public function getCount(): int
Expand All @@ -37,7 +37,7 @@ public function getCount(): int

public function testProxyCachesIsMethodReturns(): void
{
$proxy = new ComputedPropertiesProxy(new class() {
$proxy = new ComputedPropertiesProxy(new class {
private int $count = 0;

public function isCount(): int
Expand All @@ -53,7 +53,7 @@ public function isCount(): int

public function testProxyCachesHasMethodReturns(): void
{
$proxy = new ComputedPropertiesProxy(new class() {
$proxy = new ComputedPropertiesProxy(new class {
private int $count = 0;

public function hasCount(): int
Expand All @@ -69,7 +69,7 @@ public function hasCount(): int

public function testCanProxyPublicProperties(): void
{
$proxy = new ComputedPropertiesProxy(new class() {
$proxy = new ComputedPropertiesProxy(new class {
public $foo = 'bar';
});

Expand All @@ -78,7 +78,7 @@ public function testCanProxyPublicProperties(): void

public function testCanProxyArrayAccess(): void
{
$proxy = new ComputedPropertiesProxy(new class() implements \ArrayAccess {
$proxy = new ComputedPropertiesProxy(new class implements \ArrayAccess {
private $array = ['foo' => 'bar'];

public function offsetExists(mixed $offset): bool
Expand All @@ -105,7 +105,7 @@ public function offsetUnset(mixed $offset): void

public function testCannotProxyMethodsThatDoNotExist(): void
{
$proxy = new ComputedPropertiesProxy(new class() {});
$proxy = new ComputedPropertiesProxy(new class {});

$this->expectException(\InvalidArgumentException::class);

Expand All @@ -114,7 +114,7 @@ public function testCannotProxyMethodsThatDoNotExist(): void

public function testCannotPassArgumentsToProxiedMethods(): void
{
$proxy = new ComputedPropertiesProxy(new class() {});
$proxy = new ComputedPropertiesProxy(new class {});

$this->expectException(\InvalidArgumentException::class);

Expand All @@ -123,7 +123,7 @@ public function testCannotPassArgumentsToProxiedMethods(): void

public function testCannotProxyMethodsWithRequiredArguments(): void
{
$proxy = new ComputedPropertiesProxy(new class() {
$proxy = new ComputedPropertiesProxy(new class {
public function getValue(int $value): int
{
return $value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ private function createContainer()
'kernel.debug' => true,
'kernel.project_dir' => __DIR__,
'kernel.bundles' => [
'TwigBundle' => new class() {},
'TwigBundle' => new class {},
'TwigComponentBundle' => TwigComponentBundle::class,
],
]));
Expand Down
3 changes: 0 additions & 3 deletions ux.symfony.com/.php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@
'@Symfony' => true,
'@Symfony:risky' => true,
'header_comment' => ['header' => $fileHeaderComment],
'nullable_type_declaration' => true,
// TODO: Remove once the "compiler_optimized" set includes "sprintf"
'native_function_invocation' => ['include' => ['@compiler_optimized', 'sprintf'], 'scope' => 'namespaced', 'strict' => true],
'trailing_comma_in_multiline' => ['elements' => ['arrays', 'match', 'parameters']],
])
->setRiskyAllowed(true)
Expand Down

0 comments on commit 09cc7d0

Please sign in to comment.