Skip to content

Commit 49b412e

Browse files
soyukatacmanihmels
authored
chore: support symfony 7 (#6009)
* chore: symfony 7 * Add `$buildDir` to `CachePoolClearerCacheWarmer::warmUp()` Symfony 7 adds a new parameter `$buildDir` to `WarmableInterface::warmUp()`, so that the method signature of `CachePoolClearerCacheWarmer::warmUp()` needs to be updated. * more --------- Co-authored-by: Tac Tacelosky <[email protected]> Co-authored-by: Yannick Ihmels <[email protected]>
1 parent 82df722 commit 49b412e

23 files changed

+111
-105
lines changed

.github/workflows/ci.yml

Lines changed: 3 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
@@ -451,6 +452,7 @@ jobs:
451452
- name: Update project dependencies
452453
run: |
453454
composer update --no-interaction --no-progress --ansi
455+
composer require --dev doctrine/mongodb-odm-bundle
454456
- name: Install PHPUnit
455457
run: vendor/bin/simple-phpunit --version
456458
- name: Clear test app cache

.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

composer.json

Lines changed: 37 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818
"psr/cache": "^1.0 || ^2.0 || ^3.0",
1919
"psr/container": "^1.0 || ^2.0",
2020
"symfony/deprecation-contracts": "^3.1",
21-
"symfony/http-foundation": "^6.1",
22-
"symfony/http-kernel": "^6.1",
23-
"symfony/property-access": "^6.1",
24-
"symfony/property-info": "^6.1",
25-
"symfony/serializer": "^6.1",
21+
"symfony/http-foundation": "^6.1 || ^7.0",
22+
"symfony/http-kernel": "^6.1 || ^7.0",
23+
"symfony/property-access": "^6.1 || ^7.0",
24+
"symfony/property-info": "^6.1 || ^7.0",
25+
"symfony/serializer": "^6.1 || ^7.0",
2626
"symfony/translation-contracts": "^3.3",
27-
"symfony/web-link": "^6.1",
27+
"symfony/web-link": "^6.1 || ^7.0",
2828
"willdurand/negotiation": "^3.0"
2929
},
3030
"require-dev": {
@@ -35,7 +35,6 @@
3535
"doctrine/dbal": "^3.4.0",
3636
"doctrine/doctrine-bundle": "^1.12 || ^2.0",
3737
"doctrine/mongodb-odm": "^2.2",
38-
"doctrine/mongodb-odm-bundle": "^4.0",
3938
"doctrine/orm": "^2.14",
4039
"elasticsearch/elasticsearch": "^7.11.0",
4140
"friends-of-behat/mink-browserkit-driver": "^1.3.1",
@@ -56,35 +55,36 @@
5655
"ramsey/uuid-doctrine": "^1.4 || ^2.0",
5756
"soyuka/contexts": "v3.3.9",
5857
"soyuka/stubs-mongodb": "^1.0",
59-
"symfony/asset": "^6.1",
60-
"symfony/browser-kit": "^6.1",
61-
"symfony/cache": "^6.1",
62-
"symfony/config": "^6.1",
63-
"symfony/console": "^6.1",
64-
"symfony/css-selector": "^6.1",
65-
"symfony/dependency-injection": "^6.1.12",
66-
"symfony/doctrine-bridge": "^6.1",
67-
"symfony/dom-crawler": "^6.1",
68-
"symfony/error-handler": "^6.1",
69-
"symfony/event-dispatcher": "^6.1",
70-
"symfony/expression-language": "^6.1",
71-
"symfony/finder": "^6.1",
72-
"symfony/form": "^6.1",
73-
"symfony/framework-bundle": "^6.1",
74-
"symfony/http-client": "^6.1",
75-
"symfony/intl": "^6.1",
58+
"symfony/asset": "^6.1 || ^7.0",
59+
"symfony/browser-kit": "^6.1 || ^7.0",
60+
"symfony/cache": "^6.1 || ^7.0",
61+
"symfony/config": "^6.1 || ^7.0",
62+
"symfony/console": "^6.1 || ^7.0",
63+
"symfony/css-selector": "^6.1 || ^7.0",
64+
"symfony/dependency-injection": "^6.1 || ^7.0.12",
65+
"symfony/doctrine-bridge": "^6.1 || ^7.0",
66+
"symfony/dom-crawler": "^6.1 || ^7.0",
67+
"symfony/error-handler": "^6.1 || ^7.0",
68+
"symfony/event-dispatcher": "^6.1 || ^7.0",
69+
"symfony/expression-language": "^6.1 || ^7.0",
70+
"symfony/finder": "^6.1 || ^7.0",
71+
"symfony/form": "^6.1 || ^7.0",
72+
"symfony/framework-bundle": "^6.1 || ^7.0",
73+
"symfony/http-client": "^6.1 || ^7.0",
74+
"symfony/intl": "^6.1 || ^7.0",
7675
"symfony/maker-bundle": "^1.24",
7776
"symfony/mercure-bundle": "*",
78-
"symfony/messenger": "^6.1",
79-
"symfony/phpunit-bridge": "^6.1",
80-
"symfony/routing": "^6.1",
81-
"symfony/security-bundle": "^6.1",
82-
"symfony/security-core": "^6.1",
83-
"symfony/twig-bundle": "^6.1",
84-
"symfony/uid": "^6.1",
85-
"symfony/validator": "^6.1",
86-
"symfony/web-profiler-bundle": "^6.1",
87-
"symfony/yaml": "^6.1",
77+
"symfony/messenger": "^6.1 || ^7.0",
78+
"symfony/phpunit-bridge": "^6.1 || ^7.0",
79+
"symfony/routing": "^6.1 || ^7.0",
80+
"symfony/security-bundle": "^6.1 || ^7.0",
81+
"symfony/security-core": "^6.1 || ^7.0",
82+
"symfony/stopwatch": "^6.1 || ^7.0",
83+
"symfony/twig-bundle": "^6.1 || ^7.0",
84+
"symfony/uid": "^6.1 || ^7.0",
85+
"symfony/validator": "^6.1 || ^7.0",
86+
"symfony/web-profiler-bundle": "^6.1 || ^7.0",
87+
"symfony/yaml": "^6.1 || ^7.0",
8888
"twig/twig": "^1.42.3 || ^2.12 || ^3.0",
8989
"webonyx/graphql-php": "^14.0 || ^15.0"
9090
},
@@ -135,15 +135,16 @@
135135
"sort-packages": true,
136136
"allow-plugins": {
137137
"composer/package-versions-deprecated": true,
138-
"phpstan/extension-installer": true
138+
"phpstan/extension-installer": true,
139+
"php-http/discovery": true
139140
}
140141
},
141142
"extra": {
142143
"branch-alias": {
143144
"dev-main": "3.3.x-dev"
144145
},
145146
"symfony": {
146-
"require": "^6.1"
147+
"require": "^6.1 || ^7.0"
147148
}
148149
}
149150
}

phpstan.neon.dist

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ parameters:
2626
- src/Symfony/Bundle/DependencyInjection/Configuration.php
2727
# Templates for Maker
2828
- src/Symfony/Maker/Resources/skeleton
29+
# subtree split
30+
- **vendor**
31+
# Symfony 6 support
32+
- src/OpenApi/Serializer/CacheableSupportsMethodInterface.php
33+
- src/Serializer/CacheableSupportsMethodInterface.php
34+
- tests/Hal/Serializer/ItemNormalizerTest.php
35+
- tests/Symfony/Validator/Metadata/Property/ValidatorPropertyMetadataFactoryTest.php
2936
earlyTerminatingMethodCalls:
3037
PHPUnit\Framework\Constraint\Constraint:
3138
- fail
@@ -70,7 +77,6 @@ parameters:
7077
# Expected, due to optional interfaces
7178
- '#Method Symfony\\Component\\Serializer\\NameConverter\\NameConverterInterface::denormalize\(\) invoked with (2|3|4) parameters, 1 required\.#'
7279
- '#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\.#'
7480

7581
# Expected, due to backward compatibility
7682
-
@@ -85,3 +91,7 @@ parameters:
8591
-
8692
message: '#^Property .+ is unused.$#'
8793
path: tests/Doctrine/Odm/PropertyInfo/Fixtures/DoctrineDummy.php
94+
95+
# Backward compatibility
96+
- '#Call to method hasCacheableSupportsMethod\(\) on an unknown class Symfony\\Component\\Serializer\\Normalizer\\CacheableSupportsMethodInterface\.#'
97+
- '#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/Metadata/Tests/Property/PropertyInfoPropertyNameCollectionFactoryTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
use Symfony\Component\PropertyInfo\Extractor\SerializerExtractor;
2525
use Symfony\Component\PropertyInfo\PropertyInfoExtractor;
2626
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory;
27-
use Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader;
27+
use Symfony\Component\Serializer\Mapping\Loader\AttributeLoader;
2828

2929
/**
3030
* @author Oskar Stark <[email protected]>
@@ -81,7 +81,7 @@ public function testCreateMethodReturnsProperPropertyNameCollectionForObjectWith
8181
new PropertyInfoExtractor([
8282
new SerializerExtractor(
8383
new ClassMetadataFactory(
84-
new AnnotationLoader(
84+
new AttributeLoader(
8585
)
8686
)
8787
),

src/Symfony/Bundle/CacheWarmer/CachePoolClearerCacheWarmer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function __construct(private readonly Psr6CacheClearer $poolClearer, priv
3434
*
3535
* @return string[]
3636
*/
37-
public function warmUp(string $cacheDir): array
37+
public function warmUp(string $cacheDir, string $buildDir = null): array
3838
{
3939
foreach ($this->pools as $pool) {
4040
if ($this->poolClearer->hasPool($pool)) {

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/Elasticsearch/Serializer/ItemNormalizerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,12 @@ public function testGetSupportedTypes(): void
150150

151151
// TODO: use prophecy when getSupportedTypes() will be added to the interface
152152
$this->itemNormalizer = new ItemNormalizer(new class() implements NormalizerInterface {
153-
public function normalize(mixed $object, string $format = null, array $context = [])
153+
public function normalize(mixed $object, string $format = null, array $context = []): \ArrayObject|array|string|int|float|bool|null
154154
{
155155
return null;
156156
}
157157

158-
public function supportsNormalization(mixed $data, string $format = null): bool
158+
public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool
159159
{
160160
return true;
161161
}

0 commit comments

Comments
 (0)