Skip to content

Commit 2250753

Browse files
committed
[Live] require Symfony 5.4+
1 parent 5c6bb4e commit 2250753

File tree

6 files changed

+23
-71
lines changed

6 files changed

+23
-71
lines changed

src/LiveComponent/composer.json

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,24 @@
3030
"symfony/ux-twig-component": "^2.0"
3131
},
3232
"require-dev": {
33-
"symfony/framework-bundle": "^4.4|^5.0|^6.0",
34-
"symfony/dependency-injection": "^4.4.2|^5.0|^6.0",
35-
"symfony/twig-bundle": "^4.4|^5.0|^6.0",
36-
"symfony/security-csrf": "^4.4|^5.0|^6.0",
37-
"symfony/serializer": "^4.4|^5.0|^6.0",
38-
"symfony/validator": "^4.4|^5.0|^6.0",
39-
"symfony/phpunit-bridge": "^5.2|^6.0",
4033
"doctrine/annotations": "^1.0",
4134
"doctrine/doctrine-bundle": "^2.0",
4235
"doctrine/orm": "^2.7",
43-
"zenstruck/foundry": "^1.10",
44-
"zenstruck/browser": "^0.9.1"
36+
"symfony/dependency-injection": "^5.4|^6.0",
37+
"symfony/framework-bundle": "^5.4|^6.0",
38+
"symfony/phpunit-bridge": "^6.0",
39+
"symfony/security-csrf": "^5.4|^6.0",
40+
"symfony/serializer": "^5.4|^6.0",
41+
"symfony/twig-bundle": "^5.4|^6.0",
42+
"symfony/validator": "^5.4|^6.0",
43+
"zenstruck/browser": "^0.9.1",
44+
"zenstruck/foundry": "^1.10"
45+
},
46+
"conflict": {
47+
"symfony/config": "<5.4.0"
48+
},
49+
"config": {
50+
"sort-packages": true
4551
},
4652
"extra": {
4753
"thanks": {

src/LiveComponent/tests/ContainerBC.php

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/LiveComponent/tests/Fixture/Kernel.php

Lines changed: 8 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
use Symfony\Component\HttpFoundation\Response;
2222
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
2323
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
24-
use Symfony\Component\Routing\RouteCollectionBuilder;
2524
use Symfony\UX\LiveComponent\LiveComponentBundle;
2625
use Symfony\UX\LiveComponent\Tests\Fixture\Component\Component1;
2726
use Symfony\UX\LiveComponent\Tests\Fixture\Component\Component2;
@@ -63,27 +62,17 @@ protected function configureContainer(ContainerBuilder $c, LoaderInterface $load
6362
// disable logging errors to the console
6463
$c->register('logger', NullLogger::class);
6564

66-
$componentA = $c->register(Component1::class)->setAutoconfigured(true)->setAutowired(true);
67-
$componentB = $c->register(Component2::class)->setAutoconfigured(true)->setAutowired(true);
68-
$componentC = $c->register(Component3::class)->setAutoconfigured(true)->setAutowired(true);
69-
$componentF = $c->register(Component6::class)->setAutoconfigured(true)->setAutowired(true);
70-
71-
if (self::VERSION_ID < 50300) {
72-
// add tag manually
73-
$componentA->addTag('twig.component', ['key' => 'component1'])->addTag('controller.service_arguments');
74-
$componentB->addTag('twig.component', ['key' => 'component2', 'default_action' => 'defaultAction'])->addTag('controller.service_arguments');
75-
$componentC->addTag('twig.component', ['key' => 'component3'])->addTag('controller.service_arguments');
76-
$componentF->addTag('twig.component', ['key' => 'component6'])->addTag('controller.service_arguments');
77-
}
78-
79-
$sessionConfig = self::VERSION_ID < 50300 ? ['storage_id' => 'session.storage.mock_file'] : ['storage_factory_id' => 'session.storage.factory.mock_file'];
65+
$c->register(Component1::class)->setAutoconfigured(true)->setAutowired(true);
66+
$c->register(Component2::class)->setAutoconfigured(true)->setAutowired(true);
67+
$c->register(Component3::class)->setAutoconfigured(true)->setAutowired(true);
68+
$c->register(Component6::class)->setAutoconfigured(true)->setAutowired(true);
8069

8170
$c->loadFromExtension('framework', [
8271
'secret' => 'S3CRET',
8372
'test' => true,
8473
'router' => ['utf8' => true],
8574
'secrets' => false,
86-
'session' => $sessionConfig,
75+
'session' => ['storage_factory_id' => 'session.storage.factory.mock_file'],
8776
]);
8877

8978
$c->loadFromExtension('twig', [
@@ -108,21 +97,11 @@ protected function configureContainer(ContainerBuilder $c, LoaderInterface $load
10897
]);
10998
}
11099

111-
/**
112-
* @param RoutingConfigurator|RouteCollectionBuilder $routes
113-
*/
114-
protected function configureRoutes($routes): void
100+
protected function configureRoutes(RoutingConfigurator $routes): void
115101
{
116102
$routes->import('@LiveComponentBundle/Resources/config/routing/live_component.xml');
117103

118-
if ($routes instanceof RoutingConfigurator) {
119-
$routes->add('template', '/render-template/{template}')->controller('kernel::renderTemplate');
120-
$routes->add('homepage', '/')->controller('kernel::index');
121-
122-
return;
123-
}
124-
125-
$routes->add('/render-template/{template}', 'kernel::renderTemplate', 'template');
126-
$routes->add('/', 'kernel::index', 'homepage');
104+
$routes->add('template', '/render-template/{template}')->controller('kernel::renderTemplate');
105+
$routes->add('homepage', '/')->controller('kernel::index');
127106
}
128107
}

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
1515
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
1616
use Symfony\UX\LiveComponent\LiveComponentHydrator;
17-
use Symfony\UX\LiveComponent\Tests\ContainerBC;
1817
use Symfony\UX\LiveComponent\Tests\Fixture\Component\Component1;
1918
use Symfony\UX\LiveComponent\Tests\Fixture\Component\Component2;
2019
use Symfony\UX\LiveComponent\Tests\Fixture\Component\Component6;
@@ -31,7 +30,6 @@
3130
*/
3231
final class LiveComponentSubscriberTest extends KernelTestCase
3332
{
34-
use ContainerBC;
3533
use Factories;
3634
use HasBrowser;
3735
use ResetDatabase;

src/LiveComponent/tests/Integration/LiveComponentHydratorTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
1515
use Symfony\UX\LiveComponent\Attribute\LiveProp;
1616
use Symfony\UX\LiveComponent\LiveComponentHydrator;
17-
use Symfony\UX\LiveComponent\Tests\ContainerBC;
1817
use Symfony\UX\LiveComponent\Tests\Fixture\Component\Component1;
1918
use Symfony\UX\LiveComponent\Tests\Fixture\Component\Component2;
2019
use Symfony\UX\LiveComponent\Tests\Fixture\Component\Component3;
@@ -29,7 +28,6 @@
2928
*/
3029
final class LiveComponentHydratorTest extends KernelTestCase
3130
{
32-
use ContainerBC;
3331
use Factories;
3432
use ResetDatabase;
3533

src/LiveComponent/tests/Integration/Twig/LiveComponentExtensionTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,12 @@
1212
namespace Symfony\UX\LiveComponent\Tests\Integration;
1313

1414
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
15-
use Symfony\UX\LiveComponent\Tests\ContainerBC;
1615

1716
/**
1817
* @author Kevin Bond <[email protected]>
1918
*/
2019
final class LiveComponentExtensionTest extends KernelTestCase
2120
{
22-
use ContainerBC;
23-
2421
public function testGetComponentUrl(): void
2522
{
2623
$rendered = self::getContainer()->get('twig')->render('component_url.html.twig', [

0 commit comments

Comments
 (0)