From 930b545e17619bc8e5382e0777d7d2804ad1f183 Mon Sep 17 00:00:00 2001 From: soyuka Date: Fri, 29 Nov 2024 15:57:55 +0100 Subject: [PATCH 1/2] fix(symfony): symfony 7.2 deprecations --- .../Serializer/NameConverter/InnerFieldsNameConverter.php | 2 +- src/JsonApi/Serializer/ReservedAttributeNameConverter.php | 2 +- src/Symfony/Bundle/Resources/config/doctrine_mongodb_odm.xml | 4 ++-- tests/.ignored-deprecations | 1 + tests/.ignored-deprecations-legacy-events | 1 + 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Elasticsearch/Serializer/NameConverter/InnerFieldsNameConverter.php b/src/Elasticsearch/Serializer/NameConverter/InnerFieldsNameConverter.php index c55943d0054..248c0ad476e 100644 --- a/src/Elasticsearch/Serializer/NameConverter/InnerFieldsNameConverter.php +++ b/src/Elasticsearch/Serializer/NameConverter/InnerFieldsNameConverter.php @@ -24,7 +24,7 @@ * * @author Baptiste Meyer */ -final class InnerFieldsNameConverter implements AdvancedNameConverterInterface +final class InnerFieldsNameConverter implements NameConverterInterface, AdvancedNameConverterInterface { public function __construct(private readonly NameConverterInterface $inner = new CamelCaseToSnakeCaseNameConverter()) { diff --git a/src/JsonApi/Serializer/ReservedAttributeNameConverter.php b/src/JsonApi/Serializer/ReservedAttributeNameConverter.php index e25ad566dc9..d82009cdf4c 100644 --- a/src/JsonApi/Serializer/ReservedAttributeNameConverter.php +++ b/src/JsonApi/Serializer/ReservedAttributeNameConverter.php @@ -21,7 +21,7 @@ * * @author Baptiste Meyer */ -final class ReservedAttributeNameConverter implements AdvancedNameConverterInterface +final class ReservedAttributeNameConverter implements NameConverterInterface, AdvancedNameConverterInterface { public const JSON_API_RESERVED_ATTRIBUTES = [ 'id' => '_id', diff --git a/src/Symfony/Bundle/Resources/config/doctrine_mongodb_odm.xml b/src/Symfony/Bundle/Resources/config/doctrine_mongodb_odm.xml index e4206ea097d..ca2b440b753 100644 --- a/src/Symfony/Bundle/Resources/config/doctrine_mongodb_odm.xml +++ b/src/Symfony/Bundle/Resources/config/doctrine_mongodb_odm.xml @@ -154,7 +154,7 @@ - + @@ -165,7 +165,7 @@ - + diff --git a/tests/.ignored-deprecations b/tests/.ignored-deprecations index 5b58e082af0..2feeb31929c 100644 --- a/tests/.ignored-deprecations +++ b/tests/.ignored-deprecations @@ -30,3 +30,4 @@ %Since api-platform/core 3.4: Injecting the "ApiPlatform\\JsonSchema\\TypeFactoryInterface" inside "ApiPlatform\\OpenApi\\Factory\\OpenApiFactory" is deprecated and "ApiPlatform\\JsonSchema\\TypeFactoryInterface" will be removed in 4.x.% %Since api-platform/core 3.3: Use a "ApiPlatform\\State\\ProviderInterface" as first argument in "ApiPlatform\\Symfony\\EventListener\\QueryParameterValidateListener" instead of "ApiPlatform\\ParameterValidator\\ParameterValidator".% %Use quoteSingleIdentifier\(\) individually for each part of a qualified name instead.% +%class implements "Symfony\\Component\\Serializer\\NameConverter\\AdvancedNameConverterInterface" that is deprecated since Symfony 7.2, use NameConverterInterface instead.% diff --git a/tests/.ignored-deprecations-legacy-events b/tests/.ignored-deprecations-legacy-events index e9cd0f40746..4549374240d 100644 --- a/tests/.ignored-deprecations-legacy-events +++ b/tests/.ignored-deprecations-legacy-events @@ -28,3 +28,4 @@ %Since symfony/validator 7.1: Not passing a value for the "requireTld" option to the Url constraint is deprecated. Its default value will change to "true".% %Since api-platform/core 3.4: Injecting the "ApiPlatform\\JsonSchema\\TypeFactoryInterface" inside "ApiPlatform\\JsonSchema\\SchemaFactory" is deprecated and "ApiPlatform\\JsonSchema\\TypeFactoryInterface" will be removed in 4.x.% %Since api-platform/core 3.4: Injecting the "ApiPlatform\\JsonSchema\\TypeFactoryInterface" inside "ApiPlatform\\OpenApi\\Factory\\OpenApiFactory" is deprecated and "ApiPlatform\\JsonSchema\\TypeFactoryInterface" will be removed in 4.x.% +%class implements "Symfony\\Component\\Serializer\\NameConverter\\AdvancedNameConverterInterface" that is deprecated since Symfony 7.2, use NameConverterInterface instead.% From d40ac7978b03eeb74a39a7fc182014d171e6da85 Mon Sep 17 00:00:00 2001 From: soyuka Date: Sat, 30 Nov 2024 11:13:06 +0100 Subject: [PATCH 2/2] fix twig profiler issue --- .../views/DataCollector/request.html.twig | 111 +++++++++--------- .../Twig/ApiPlatformProfilerPanelTest.php | 8 +- 2 files changed, 56 insertions(+), 63 deletions(-) diff --git a/src/Symfony/Bundle/Resources/views/DataCollector/request.html.twig b/src/Symfony/Bundle/Resources/views/DataCollector/request.html.twig index dedfca3e5fc..72d11e547ea 100644 --- a/src/Symfony/Bundle/Resources/views/DataCollector/request.html.twig +++ b/src/Symfony/Bundle/Resources/views/DataCollector/request.html.twig @@ -139,67 +139,62 @@ {% if dataCollected.resourceMetadataCollection is not empty %} -
-
- -

Resources

-
{% endif %} diff --git a/tests/Symfony/Bundle/Twig/ApiPlatformProfilerPanelTest.php b/tests/Symfony/Bundle/Twig/ApiPlatformProfilerPanelTest.php index f8e65642012..577ea0a0466 100644 --- a/tests/Symfony/Bundle/Twig/ApiPlatformProfilerPanelTest.php +++ b/tests/Symfony/Bundle/Twig/ApiPlatformProfilerPanelTest.php @@ -147,14 +147,12 @@ public function testProfilerGeneralLayout(): void $this->assertCount(1, $metrics->filter('.metric'), 'The should be one metric displayed (resource class).'); $this->assertSame('mongodb' === $this->env ? DocumentDummy::class : Dummy::class, $metrics->filter('span.value')->html()); - $this->assertCount(4, $crawler->filter('.sf-tabs .tab-content'), 'Tabs must be presents on the panel.'); + $this->assertCount(3, $crawler->filter('.sf-tabs .tab-content'), 'Tabs must be presents on the panel.'); - // Metadata tab - $this->assertSame('Metadata', $crawler->filter('.tab:nth-of-type(1) .tab-title')->html()); - $tabContent = $crawler->filter('.tab:nth-of-type(1) .tab-content'); + $tabContent = $crawler->filter('.tab:nth-of-type(1)'); $this->assertStringEndsWith('Dummy', trim($tabContent->filter('h3')->html()), 'the resource shortname should be displayed.'); - $this->assertCount(9, $tabContent->filter('table')); + $this->assertCount(3, $tabContent->filter('table')); $this->assertSame('Resource', $tabContent->filter('table:first-of-type thead th:first-of-type')->html()); $this->assertSame('Operations', $tabContent->filter('table:nth-of-type(2) thead th:first-of-type')->html()); $this->assertSame('Filters', $tabContent->filter('table:nth-of-type(3) thead th:first-of-type')->html());