Skip to content

Commit

Permalink
Apply php-cs-fixer rules
Browse files Browse the repository at this point in the history
  • Loading branch information
smnandre committed Aug 17, 2024
1 parent a7bec37 commit 4b07446
Show file tree
Hide file tree
Showing 13 changed files with 86 additions and 87 deletions.
1 change: 1 addition & 0 deletions src/Icons/src/Twig/UXIconRuntime.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public function renderIcon(string $name, array $attributes = []): string
} catch (IconNotFoundException $e) {
if ($this->ignoreNotFound) {
$this->logger?->warning($e->getMessage());

return '';
}

Expand Down
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
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ public function testGetLiveAction(): void
$this->assertSame('data-action="live#action" data-live-prop1-param="val1" data-live-some-prop-param="val2" data-live-action-param="action-name"', $props);

$props = $runtime->liveAction('action-name', ['prop1' => 'val1', 'prop2' => 'val2'], ['debounce' => 300]);
$this->assertSame('data-action="live#action" data-live-prop1-param="val1" data-live-prop2-param="val2" data-live-action-param="debounce(300)|action-name"', \html_entity_decode($props));
$this->assertSame('data-action="live#action" data-live-prop1-param="val1" data-live-prop2-param="val2" data-live-action-param="debounce(300)|action-name"', html_entity_decode($props));
$this->assertSame('data-action="live#action" data-live-prop1-param="val1" data-live-prop2-param="val2" data-live-action-param="debounce(300)|action-name"', $props);

$props = $runtime->liveAction('action-name:prevent', ['pro1' => 'val1', 'prop2' => 'val2'], ['debounce' => 300]);
$this->assertSame('data-action="live#action:prevent" data-live-pro1-param="val1" data-live-prop2-param="val2" data-live-action-param="debounce(300)|action-name"', \html_entity_decode($props));
$this->assertSame('data-action="live#action:prevent" data-live-pro1-param="val1" data-live-prop2-param="val2" data-live-action-param="debounce(300)|action-name"', html_entity_decode($props));
$this->assertSame('data-action="live#action:prevent" data-live-pro1-param="val1" data-live-prop2-param="val2" data-live-action-param="debounce(300)|action-name"', $props);

$props = $runtime->liveAction('action-name:prevent', [], ['debounce' => 300]);
$this->assertSame('data-action="live#action:prevent" data-live-action-param="debounce(300)|action-name"', \html_entity_decode($props));
$this->assertSame('data-action="live#action:prevent" data-live-action-param="debounce(300)|action-name"', html_entity_decode($props));

$props = $runtime->liveAction('action-name', [], [], 'keydown.esc');
$this->assertSame('data-action="keydown.esc->live#action" data-live-action-param="action-name"', \html_entity_decode($props));
$this->assertSame('data-action="keydown.esc->live#action" data-live-action-param="action-name"', html_entity_decode($props));
}
}
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

0 comments on commit 4b07446

Please sign in to comment.