Skip to content

Commit 9662412

Browse files
authored
chore: remove 3.4 deprecation (#7188)
1 parent d51cddb commit 9662412

File tree

61 files changed

+35
-1259
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+35
-1259
lines changed

phpstan.neon.dist

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,6 @@ parameters:
7777
- '#Method Symfony\\Component\\Serializer\\NameConverter\\NameConverterInterface::normalize\(\) invoked with (2|3|4) parameters, 1 required\.#'
7878

7979
# Expected, due to backward compatibility
80-
-
81-
message: "#Call to function method_exists\\(\\) with ApiPlatform\\\\JsonApi\\\\Serializer\\\\ItemNormalizer and 'setCircularReferenc…' will always evaluate to false\\.#"
82-
path: src/JsonApi/Tests/Serializer/ItemNormalizerTest.php
8380
- '#Method GraphQL\\Type\\Definition\\WrappingType::getWrappedType\(\) invoked with 1 parameter, 0 required\.#'
8481
- '#Access to an undefined property GraphQL\\Type\\Definition\\NamedType&GraphQL\\Type\\Definition\\Type::\$name\.#'
8582
-

src/Documentation/Action/DocumentationAction.php

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

src/Documentation/Action/EntrypointAction.php

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

src/Elasticsearch/Serializer/ItemNormalizer.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,6 @@ public function supportsNormalization(mixed $data, ?string $format = null, array
7979

8080
public function getSupportedTypes($format): array
8181
{
82-
// @deprecated remove condition when support for symfony versions under 6.3 is dropped
83-
if (!method_exists($this->decorated, 'getSupportedTypes')) {
84-
return [
85-
DocumentNormalizer::FORMAT => null,
86-
];
87-
}
88-
8982
return DocumentNormalizer::FORMAT !== $format ? $this->decorated->getSupportedTypes($format) : [];
9083
}
9184

src/Elasticsearch/State/Options.php

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ class Options implements OptionsInterface
1919
{
2020
public function __construct(
2121
protected ?string $index = null,
22-
/**
23-
* @deprecated this parameter is not used anymore
24-
*/
25-
protected ?string $type = null,
2622
) {
2723
}
2824

@@ -38,17 +34,4 @@ public function withIndex(?string $index): self
3834

3935
return $self;
4036
}
41-
42-
public function getType(): ?string
43-
{
44-
return $this->type;
45-
}
46-
47-
public function withType(?string $type): self
48-
{
49-
$self = clone $this;
50-
$self->type = $type;
51-
52-
return $self;
53-
}
5437
}

src/Elasticsearch/Tests/Metadata/Resource/Factory/ElasticsearchProviderResourceMetadataCollectionFactoryTest.php

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,7 @@
1414
namespace ApiPlatform\Elasticsearch\Tests\Metadata\Resource\Factory;
1515

1616
use ApiPlatform\Elasticsearch\Metadata\Resource\Factory\ElasticsearchProviderResourceMetadataCollectionFactory;
17-
use ApiPlatform\Elasticsearch\Tests\Fixtures\Foo;
18-
use ApiPlatform\Elasticsearch\Tests\Fixtures\Metadata\Get;
19-
use ApiPlatform\Metadata\ApiResource;
2017
use ApiPlatform\Metadata\Resource\Factory\ResourceMetadataCollectionFactoryInterface;
21-
use ApiPlatform\Metadata\Resource\ResourceMetadataCollection;
2218
use PHPUnit\Framework\TestCase;
2319
use Prophecy\PhpUnit\ProphecyTrait;
2420

@@ -35,28 +31,4 @@ public function testConstruct(): void
3531
)
3632
);
3733
}
38-
39-
#[\PHPUnit\Framework\Attributes\DataProvider('elasticsearchProvider')]
40-
public function testCreate(?bool $elasticsearchFlag, ?bool $expectedResult): void
41-
{
42-
$get = (new Get(elasticsearch: $elasticsearchFlag, shortName: 'Foo'));
43-
$resource = (new ApiResource(operations: ['foo_get' => $get]));
44-
$metadata = new ResourceMetadataCollection(Foo::class, [$resource]);
45-
46-
$decorated = $this->prophesize(ResourceMetadataCollectionFactoryInterface::class);
47-
$decorated->create(Foo::class)->willReturn($metadata)->shouldBeCalled();
48-
49-
$resourceMetadataFactory = new ElasticsearchProviderResourceMetadataCollectionFactory($decorated->reveal());
50-
$elasticsearchResult = $resourceMetadataFactory->create(Foo::class)->getOperation('foo_get')->getElasticsearch();
51-
self::assertEquals($expectedResult, $elasticsearchResult);
52-
}
53-
54-
public static function elasticsearchProvider(): array
55-
{
56-
return [
57-
'elasticsearch: false' => [false, false],
58-
'elasticsearch: null' => [null, false],
59-
'elasticsearch: true' => [true, true],
60-
];
61-
}
6234
}

src/JsonApi/Serializer/ErrorNormalizerTrait.php

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

src/JsonApi/Tests/Serializer/ItemNormalizerTest.php

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@
3333
use PHPUnit\Framework\TestCase;
3434
use Prophecy\Argument;
3535
use Prophecy\PhpUnit\ProphecyTrait;
36+
use Symfony\Component\HttpFoundation\EventStreamResponse;
3637
use Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException;
3738
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
3839
use Symfony\Component\PropertyInfo\Type;
3940
use Symfony\Component\Serializer\Exception\NotNormalizableValueException;
4041
use Symfony\Component\Serializer\Exception\UnexpectedValueException;
41-
use Symfony\Component\Serializer\NameConverter\AdvancedNameConverterInterface;
4242
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
4343
use Symfony\Component\Serializer\Serializer;
4444
use Symfony\Component\Serializer\SerializerInterface;
@@ -153,21 +153,13 @@ public function testNormalizeCircularReference(): void
153153

154154
$normalizer->setSerializer($this->prophesize(SerializerInterface::class)->reveal());
155155

156-
$circularReferenceLimit = 2;
157-
if (!interface_exists(AdvancedNameConverterInterface::class) && method_exists($normalizer, 'setCircularReferenceLimit')) {
158-
$normalizer->setCircularReferenceLimit($circularReferenceLimit);
159-
160-
$context = [
161-
'circular_reference_limit' => [spl_object_hash($circularReferenceEntity) => 2],
162-
'cache_error' => function (): void {},
163-
];
164-
} else {
165-
$context = [
166-
'circular_reference_limit' => $circularReferenceLimit,
167-
'circular_reference_limit_counters' => [spl_object_hash($circularReferenceEntity) => 2],
168-
'cache_error' => function (): void {},
169-
];
170-
}
156+
// Symfony >= 7.3
157+
$splObject = class_exists(EventStreamResponse::class) ? spl_object_id($circularReferenceEntity) : spl_object_hash($circularReferenceEntity);
158+
$context = [
159+
'circular_reference_limit' => 2,
160+
'circular_reference_limit_counters' => [$splObject => 2],
161+
'cache_error' => function (): void {},
162+
];
171163

172164
$this->assertSame('/circular_references/1', $normalizer->normalize($circularReferenceEntity, ItemNormalizer::FORMAT, $context));
173165
}

0 commit comments

Comments
 (0)