Skip to content

Commit 4806ffa

Browse files
committed
more stuff
1 parent dc51ebe commit 4806ffa

File tree

11 files changed

+26
-31
lines changed

11 files changed

+26
-31
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ jobs:
8787
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
8888
restore-keys: ${{ runner.os }}-composer-
8989
- name: Update project dependencies
90-
run: composer update --no-interaction --no-progress --ansi
90+
run: |
91+
composer update --no-interaction --no-progress --ansi
9192
- name: Install PHPUnit
9293
run: vendor/bin/simple-phpunit --version
9394
- name: Cache PHPStan results

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
*.log
22
/.php-cs-fixer.php
33
/.php-cs-fixer.cache
4-
/.phpunit.result.cache
4+
.phpunit.result.cache
55
/.phpunit.cache/
66
/build/
7-
/composer.lock
7+
composer.lock
88
/composer.phar
99
/phpstan.neon
1010
/phpunit.xml

phpstan.neon.dist

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ parameters:
1616
- src/Symfony/Bundle/Test/Constraint/ArraySubset.php
1717
- tests/Fixtures/app/AppKernel.php
1818
excludePaths:
19+
- src/OpenApi/Serializer/CacheableSupportsMethodInterface.php
20+
- src/Serializer/CacheableSupportsMethodInterface.php
1921
- src/Symfony/Bundle/Command/OpenApiCommand.php
2022
# Symfony config
2123
- tests/Fixtures/app/config/config_swagger.php
@@ -26,6 +28,7 @@ parameters:
2628
- src/Symfony/Bundle/DependencyInjection/Configuration.php
2729
# Templates for Maker
2830
- src/Symfony/Maker/Resources/skeleton
31+
- **vendor**
2932
earlyTerminatingMethodCalls:
3033
PHPUnit\Framework\Constraint\Constraint:
3134
- fail
@@ -70,7 +73,6 @@ parameters:
7073
# Expected, due to optional interfaces
7174
- '#Method Symfony\\Component\\Serializer\\NameConverter\\NameConverterInterface::denormalize\(\) invoked with (2|3|4) parameters, 1 required\.#'
7275
- '#Method Symfony\\Component\\Serializer\\NameConverter\\NameConverterInterface::normalize\(\) invoked with (2|3|4) parameters, 1 required\.#'
73-
- '#Method Symfony\\Component\\Serializer\\Normalizer\\NormalizerInterface::supportsNormalization\(\) invoked with 3 parameters, 1-2 required\.#'
7476

7577
# Expected, due to backward compatibility
7678
-
@@ -85,3 +87,7 @@ parameters:
8587
-
8688
message: '#^Property .+ is unused.$#'
8789
path: tests/Doctrine/Odm/PropertyInfo/Fixtures/DoctrineDummy.php
90+
91+
# Backward compatibility
92+
- '#Call to method hasCacheableSupportsMethod\(\) on an unknown class Symfony\\Component\\Serializer\\Normalizer\\CacheableSupportsMethodInterface\.#'
93+
- '#Class Symfony\\Component\\Serializer\\Normalizer\\CacheableSupportsMethodInterface not found\.#'

src/Elasticsearch/Serializer/DocumentNormalizer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function __construct(
5858
*/
5959
public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool
6060
{
61-
return self::FORMAT === $format && $this->decoratedNormalizer->supportsDenormalization($data, $type, $format, $context); // @phpstan-ignore-line symfony bc-layer
61+
return self::FORMAT === $format && $this->decoratedNormalizer->supportsDenormalization($data, $type, $format, $context);
6262
}
6363

6464
/**

src/Elasticsearch/Serializer/ItemNormalizer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function supportsDenormalization(mixed $data, string $type, string $forma
8282
throw new LogicException(sprintf('The decorated normalizer must be an instance of "%s".', DenormalizerInterface::class));
8383
}
8484

85-
return DocumentNormalizer::FORMAT !== $format && $this->decorated->supportsDenormalization($data, $type, $format, $context); // @phpstan-ignore-line symfony bc-layer
85+
return DocumentNormalizer::FORMAT !== $format && $this->decorated->supportsDenormalization($data, $type, $format, $context);
8686
}
8787

8888
/**

src/Test/DoctrineMongoDbOdmFilterTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ protected function setUp(): void
4141
self::bootKernel();
4242

4343
$this->manager = DoctrineMongoDbOdmTestCase::createTestDocumentManager();
44-
$this->managerRegistry = self::$kernel->getContainer()->get('doctrine_mongodb');
44+
$this->managerRegistry = self::$kernel->getContainer()->get('doctrine_mongodb'); // @phpstan-ignore-line
4545
$this->repository = $this->manager->getRepository($this->resourceClass);
4646
}
4747

tests/Fixtures/TestBundle/Serializer/Normalizer/OverrideDocumentationNormalizer.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function __construct(private readonly NormalizerInterface $documentationN
3131
*
3232
* @throws ExceptionInterface
3333
*/
34-
public function normalize($object, $format = null, array $context = [])
34+
public function normalize($object, $format = null, array $context = []): \ArrayObject|array|string|int|float|bool|null
3535
{
3636
$data = $this->documentationNormalizer->normalize($object, $format, $context);
3737
if (!\is_array($data)) {
@@ -50,8 +50,13 @@ public function normalize($object, $format = null, array $context = [])
5050
/**
5151
* @param mixed|null $format
5252
*/
53-
public function supportsNormalization($data, $format = null): bool
53+
public function supportsNormalization($data, $format = null, array $context = []): bool
5454
{
55-
return $this->documentationNormalizer->supportsNormalization($data, $format);
55+
return $this->documentationNormalizer->supportsNormalization($data, $format, $context);
56+
}
57+
58+
public function getSupportedTypes(?string $format): array
59+
{
60+
return [];
5661
}
5762
}

tests/Fixtures/app/AppKernel.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,9 +278,9 @@ protected function build(ContainerBuilder $container): void
278278
$container->addCompilerPass(new class() implements CompilerPassInterface {
279279
public function process(ContainerBuilder $container): void
280280
{
281-
if ($container->hasDefinition(TailCursorDoctrineODMCommand::class)) {
281+
if ($container->hasDefinition(TailCursorDoctrineODMCommand::class)) { // @phpstan-ignore-line
282282
// Deprecated command triggering a Symfony depreciation
283-
$container->removeDefinition(TailCursorDoctrineODMCommand::class);
283+
$container->removeDefinition(TailCursorDoctrineODMCommand::class); // @phpstan-ignore-line
284284
}
285285
}
286286
});

tests/Hydra/Serializer/CollectionFiltersNormalizerTest.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
use Prophecy\Argument;
3131
use Prophecy\PhpUnit\ProphecyTrait;
3232
use Psr\Container\ContainerInterface;
33-
use Symfony\Component\Serializer\Normalizer\CacheableSupportsMethodInterface;
3433
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
3534
use Symfony\Component\Serializer\Serializer;
3635

@@ -47,10 +46,6 @@ class CollectionFiltersNormalizerTest extends TestCase
4746
public function testSupportsNormalization(): void
4847
{
4948
$decoratedProphecy = $this->prophesize(NormalizerInterface::class);
50-
if (!method_exists(Serializer::class, 'getSupportedTypes')) {
51-
$decoratedProphecy->willImplement(CacheableSupportsMethodInterface::class);
52-
$decoratedProphecy->hasCacheableSupportsMethod()->willReturn(true)->shouldBeCalled();
53-
}
5449
$decoratedProphecy->supportsNormalization('foo', 'abc', Argument::type('array'))->willReturn(true)->shouldBeCalled();
5550

5651
$normalizer = new CollectionFiltersNormalizer(
@@ -61,10 +56,6 @@ public function testSupportsNormalization(): void
6156
);
6257

6358
$this->assertTrue($normalizer->supportsNormalization('foo', 'abc'));
64-
65-
if (!method_exists(Serializer::class, 'getSupportedTypes')) {
66-
$this->assertTrue($normalizer->hasCacheableSupportsMethod());
67-
}
6859
}
6960

7061
public function testNormalizeNonResourceCollection(): void

tests/Hydra/Serializer/PartialCollectionViewNormalizerTest.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -165,20 +165,12 @@ private function normalizePaginator(bool $partial = false, bool $cursor = false)
165165
public function testSupportsNormalization(): void
166166
{
167167
$decoratedNormalizerProphecy = $this->prophesize(NormalizerInterface::class);
168-
if (!method_exists(Serializer::class, 'getSupportedTypes')) {
169-
$decoratedNormalizerProphecy->willImplement(CacheableSupportsMethodInterface::class);
170-
$decoratedNormalizerProphecy->hasCacheableSupportsMethod()->willReturn(true)->shouldBeCalled();
171-
}
172168
$decoratedNormalizerProphecy->supportsNormalization(Argument::any(), null, Argument::type('array'))->willReturn(true)->shouldBeCalled();
173169

174170
$resourceMetadataFactory = $this->prophesize(ResourceMetadataCollectionFactoryInterface::class);
175171

176172
$normalizer = new PartialCollectionViewNormalizer($decoratedNormalizerProphecy->reveal(), 'page', 'pagination', $resourceMetadataFactory->reveal());
177173
$this->assertTrue($normalizer->supportsNormalization(new \stdClass()));
178-
179-
if (!method_exists(Serializer::class, 'getSupportedTypes')) {
180-
$this->assertTrue($normalizer->hasCacheableSupportsMethod());
181-
}
182174
}
183175

184176
public function testSetNormalizer(): void

0 commit comments

Comments
 (0)