Skip to content

Commit 09bbd68

Browse files
committed
[LiveComponent] Fix PHP8.4 errors + deprecations
1 parent b083b76 commit 09bbd68

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

src/LiveComponent/tests/Fixtures/Entity/TodoItemFixtureEntity.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,12 @@ class TodoItemFixtureEntity
2424
public $id;
2525

2626
#[ORM\Column(type: 'string')]
27-
private ?string $name = null;
27+
private ?string $name;
2828

2929
#[ORM\ManyToOne(targetEntity: TodoListFixtureEntity::class, inversedBy: 'todoItems')]
3030
private TodoListFixtureEntity $todoList;
3131

32-
/**
33-
* @param string $name
34-
*/
35-
public function __construct(string $name = null)
32+
public function __construct(?string $name = null)
3633
{
3734
$this->name = $name;
3835
}

src/LiveComponent/tests/Fixtures/Kernel.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,14 @@ public function index(): Response
5151
return new Response('index');
5252
}
5353

54-
public function renderTemplate(string $template, Environment $twig = null): Response
54+
public function renderTemplate(string $template, ?Environment $twig = null): Response
5555
{
5656
$twig ??= $this->container->get('twig');
5757

5858
return new Response($twig->render("{$template}.html.twig"));
5959
}
6060

61-
public function renderNamespacedTemplate(string $template, Environment $twig = null): Response
61+
public function renderNamespacedTemplate(string $template, ?Environment $twig = null): Response
6262
{
6363
$twig ??= $this->container->get('twig');
6464

@@ -171,6 +171,7 @@ protected function configureContainer(ContainerConfigurator $c): void
171171
],
172172
],
173173
];
174+
174175
if (null !== $doctrineBundleVersion = InstalledVersions::getVersion('doctrine/doctrine-bundle')) {
175176
if (version_compare($doctrineBundleVersion, '2.8.0', '>=')) {
176177
$doctrineConfig['orm']['enable_lazy_ghost_objects'] = true;
@@ -181,6 +182,9 @@ protected function configureContainer(ContainerConfigurator $c): void
181182
$doctrineConfig['orm']['validate_xml_mapping'] = true;
182183
$doctrineConfig['dbal']['schema_manager_factory'] = 'doctrine.dbal.default_schema_manager_factory';
183184
}
185+
if (version_compare($doctrineBundleVersion, '2.12.0', '=')) {
186+
$doctrineConfig['orm']['controller_resolver']['auto_mapping'] = true;
187+
}
184188
}
185189

186190
$c->extension('doctrine', $doctrineConfig);

src/LiveComponent/tests/Fixtures/Serializer/Entity2Normalizer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function supportsNormalization(mixed $data, string $format = null, array
4747
return $data instanceof Entity2;
4848
}
4949

50-
public function getSupportedTypes(?string $format): array
50+
public function getSupportedTypes(?string $format = null): array
5151
{
5252
return [Entity2::class => true];
5353
}

src/LiveComponent/tests/Fixtures/Serializer/MoneyNormalizer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function supportsNormalization(mixed $data, string $format = null, array
3737
return $data instanceof Money;
3838
}
3939

40-
public function getSupportedTypes(?string $format): array
40+
public function getSupportedTypes(string $format = null): array
4141
{
4242
return [Money::class => true];
4343
}

0 commit comments

Comments
 (0)