Skip to content

Commit dbe4f44

Browse files
committed
refactor: Update to Symfony 7.4
1 parent dfb763d commit dbe4f44

14 files changed

Lines changed: 82 additions & 74 deletions

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/.idea/
22
/composer.lock
33
/vendor/
4-
/.phpunit.result.cache
4+
/.phpunit.cache
55
/symfony.lock

composer.json

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,49 +23,50 @@
2323
}
2424
},
2525
"require": {
26-
"php": ">=8.4",
27-
"api-platform/symfony": "^4.1.15",
26+
"php": ">=8.5",
27+
"api-platform/symfony": "^4.2",
2828
"dontdrinkandroot/common": "^0.3",
29-
"symfony/config": "^6.4",
30-
"symfony/dependency-injection": "^6.4",
31-
"symfony/security-core": "^6.4",
32-
"symfony/yaml": "^6.4"
29+
"symfony/config": "^7.4",
30+
"symfony/dependency-injection": "^7.4",
31+
"symfony/security-core": "^7.4",
32+
"symfony/yaml": "^7.4"
3333
},
3434
"require-dev": {
35-
"api-platform/doctrine-orm": "^4.1",
36-
"doctrine/doctrine-bundle": "^2.10",
37-
"doctrine/doctrine-fixtures-bundle": "^3.4",
38-
"doctrine/orm": "^2.16",
35+
"api-platform/doctrine-orm": "^4.2",
36+
"doctrine/doctrine-bundle": "^3.2",
37+
"doctrine/doctrine-fixtures-bundle": "^4.3",
38+
"doctrine/orm": "^3.6",
3939
"dontdrinkandroot/symfony-version-enforcer": "^0.1.1",
40-
"liip/test-fixtures-bundle": "^2.5",
40+
"liip/test-fixtures-bundle": "^3.7",
4141
"phpstan/extension-installer": "^1.4",
4242
"phpstan/phpstan": "^2.1",
4343
"phpstan/phpstan-doctrine": "^2.0",
4444
"phpstan/phpstan-strict-rules": "^2.0",
4545
"phpstan/phpstan-symfony": "^2.0",
46-
"phpunit/phpunit": "^9.6",
47-
"symfony/browser-kit": "^6.4",
48-
"symfony/framework-bundle": "^6.4",
49-
"symfony/phpunit-bridge": "^6.4",
50-
"symfony/security-bundle": "^6.4",
51-
"symfony/validator": "^6.4"
46+
"phpunit/phpunit": "^12.5",
47+
"symfony/browser-kit": "^7.4",
48+
"symfony/framework-bundle": "^7.4",
49+
"symfony/security-bundle": "^7.4",
50+
"symfony/validator": "^7.4",
51+
"symfony/runtime": "^7.4"
5252
},
5353
"suggest": {
5454
},
5555
"config": {
5656
"sort-packages": true,
5757
"allow-plugins": {
5858
"dontdrinkandroot/symfony-version-enforcer": true,
59-
"phpstan/extension-installer": true
59+
"phpstan/extension-installer": true,
60+
"symfony/runtime": true
6061
}
6162
},
6263
"extra": {
6364
"symfony": {
64-
"require": "6.4.*",
65+
"require": "7.4.*",
6566
"allow-contrib": true
6667
},
6768
"branch-alias": {
68-
"dev-master": "0.4.x-dev"
69+
"dev-main": "0.5.x-dev"
6970
}
7071
}
7172
}

phpunit.xml.dist

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" colors="true"
3-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
42

3+
<!-- https://phpunit.readthedocs.io/en/latest/configuration.html -->
4+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
6+
colors="true"
7+
failOnDeprecation="true"
8+
failOnNotice="true"
9+
failOnWarning="true"
10+
cacheDirectory=".phpunit.cache"
11+
>
512
<php>
6-
<ini name="memory_limit" value="-1" />
7-
<env name="APP_SECRET" value="c2143e0e6fa7397bf72e127fc8ccf2b5" />
8-
<env name="SHELL_VERBOSITY" value="-1" />
9-
<env name="KERNEL_CLASS" value="Dontdrinkandroot\ApiPlatformBundle\Tests\TestApp\TestKernel" />
13+
<ini name="display_errors" value="1"/>
14+
<ini name="error_reporting" value="-1"/>
15+
<server name="APP_ENV" value="test" force="true"/>
16+
<server name="SHELL_VERBOSITY" value="-1"/>
1017
<env name="SYMFONY_DEPRECATIONS_HELPER" value="max[direct]=0" />
11-
<env name="SYMFONY_PHPUNIT_VERSION" value="9.5" />
18+
<env name="KERNEL_CLASS" value="Dontdrinkandroot\ApiPlatformBundle\Tests\TestApp\TestKernel"/>
19+
<env name="DATABASE_URL" value="sqlite:////tmp/ddr_api_platform_bundle.db"/>
20+
<env name="APP_SECRET" value="$ecretf0rt3st"/>
1221
</php>
1322

1423
<testsuites>
@@ -17,14 +26,22 @@
1726
</testsuite>
1827
</testsuites>
1928

20-
<coverage processUncoveredFiles="true">
29+
<source ignoreSuppressionOfDeprecations="true"
30+
ignoreIndirectDeprecations="true"
31+
restrictNotices="true"
32+
restrictWarnings="true"
33+
>
2134
<include>
22-
<directory suffix=".php">src</directory>
35+
<directory>src</directory>
2336
</include>
24-
</coverage>
2537

26-
<listeners>
27-
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
28-
</listeners>
38+
<deprecationTrigger>
39+
<method>Doctrine\Deprecations\Deprecation::trigger</method>
40+
<method>Doctrine\Deprecations\Deprecation::delegateTriggerToBackend</method>
41+
<function>trigger_deprecation</function>
42+
</deprecationTrigger>
43+
</source>
2944

45+
<extensions>
46+
</extensions>
3047
</phpunit>

rector.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@
1717
$rectorConfig->sets([
1818
LevelSetList::UP_TO_PHP_83,
1919
LevelSetList::UP_TO_PHP_84,
20+
LevelSetList::UP_TO_PHP_85,
2021
SetList::TYPE_DECLARATION,
21-
SymfonySetList::SYMFONY_61,
22-
SymfonySetList::SYMFONY_62,
23-
SymfonySetList::SYMFONY_63,
24-
SymfonySetList::SYMFONY_64,
22+
SymfonySetList::SYMFONY_71,
23+
SymfonySetList::SYMFONY_72,
24+
SymfonySetList::SYMFONY_73,
25+
SymfonySetList::SYMFONY_74,
2526
]);
2627
};

src/Serializer/AutomaticSerializationGroupsResourceMetadataFactory.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use ApiPlatform\Metadata\Delete;
77
use ApiPlatform\Metadata\Get;
88
use ApiPlatform\Metadata\GetCollection;
9+
use ApiPlatform\Metadata\HttpOperation;
910
use ApiPlatform\Metadata\Operation;
1011
use ApiPlatform\Metadata\Operations;
1112
use ApiPlatform\Metadata\Patch;
@@ -16,7 +17,6 @@
1617
use Dontdrinkandroot\Common\ClassNameUtils;
1718
use Dontdrinkandroot\Common\CrudOperation;
1819
use Override;
19-
use ReflectionClass;
2020
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
2121

2222
readonly class AutomaticSerializationGroupsResourceMetadataFactory implements ResourceMetadataCollectionFactoryInterface
@@ -84,7 +84,8 @@ private function getResourceShortName(string $resourceClass): string
8484
}
8585

8686
/**
87-
* @return array<string, Operation>
87+
* @param Operations<HttpOperation> $operations
88+
* @return array<string, HttpOperation>
8889
*/
8990
private function processOperations(Operations $operations, string $shortName): array
9091
{
@@ -97,7 +98,7 @@ private function processOperations(Operations $operations, string $shortName): a
9798
return $processedOperations;
9899
}
99100

100-
private function processSingleOperation(Operation $operation, string $shortName): Operation
101+
private function processSingleOperation(HttpOperation $operation, string $shortName): HttpOperation
101102
{
102103
$crudOperation = $this->resolveCrudOperation($operation);
103104
if ($crudOperation === null) {
@@ -113,7 +114,7 @@ private function processSingleOperation(Operation $operation, string $shortName)
113114
};
114115
}
115116

116-
private function applyListGroups(Operation $operation, string $shortName): Operation
117+
private function applyListGroups(HttpOperation $operation, string $shortName): HttpOperation
117118
{
118119
if ($this->hasExistingNormalizationGroups($operation)) {
119120
return $operation;
@@ -124,7 +125,7 @@ private function applyListGroups(Operation $operation, string $shortName): Opera
124125
]);
125126
}
126127

127-
private function applyCreateGroups(Operation $operation, string $shortName): Operation
128+
private function applyCreateGroups(HttpOperation $operation, string $shortName): HttpOperation
128129
{
129130
$updatedOperation = $operation;
130131

@@ -143,7 +144,7 @@ private function applyCreateGroups(Operation $operation, string $shortName): Ope
143144
return $updatedOperation;
144145
}
145146

146-
private function applyReadGroups(Operation $operation, string $shortName): Operation
147+
private function applyReadGroups(HttpOperation $operation, string $shortName): HttpOperation
147148
{
148149
if ($this->hasExistingNormalizationGroups($operation)) {
149150
return $operation;
@@ -154,7 +155,7 @@ private function applyReadGroups(Operation $operation, string $shortName): Opera
154155
]);
155156
}
156157

157-
private function applyUpdateGroups(Operation $operation, string $shortName): Operation
158+
private function applyUpdateGroups(HttpOperation $operation, string $shortName): HttpOperation
158159
{
159160
$updatedOperation = $operation;
160161

tests/Acceptance/AbstractAcceptanceTest.php renamed to tests/Acceptance/AbstractAcceptanceTestCase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
use Liip\TestFixturesBundle\Services\DatabaseToolCollection;
88
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
99

10-
abstract class AbstractAcceptanceTest extends WebTestCase
10+
abstract class AbstractAcceptanceTestCase extends WebTestCase
1111
{
1212
use ApiTestTrait;
1313

1414
/**
15-
* @param class-string[] $classNames
15+
* @param list<class-string> $classNames
1616
*/
1717
protected static function loadFixtures(array $classNames = []): ReferenceRepository
1818
{

tests/Acceptance/DepartmentEndpointTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use Dontdrinkandroot\ApiPlatformBundle\Tests\TestApp\Entity\Department;
1111
use Symfony\Component\HttpFoundation\Response;
1212

13-
class DepartmentEndpointTest extends AbstractAcceptanceTest
13+
class DepartmentEndpointTest extends AbstractAcceptanceTestCase
1414
{
1515
public function testPostWithMissingFields(): void
1616
{

tests/Acceptance/GroupEndpointTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use Dontdrinkandroot\ApiPlatformBundle\Tests\TestApp\Entity\Group;
1010
use Symfony\Component\HttpFoundation\Response;
1111

12-
class GroupEndpointTest extends AbstractAcceptanceTest
12+
class GroupEndpointTest extends AbstractAcceptanceTestCase
1313
{
1414
public function testReadProtected(): void
1515
{

tests/Acceptance/UserEndpointTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use Dontdrinkandroot\ApiPlatformBundle\Tests\TestApp\Entity\User;
1111
use Symfony\Component\HttpFoundation\Response;
1212

13-
class UserEndpointTest extends AbstractAcceptanceTest
13+
class UserEndpointTest extends AbstractAcceptanceTestCase
1414
{
1515
public function testPostUnauthorized(): void
1616
{

tests/TestApp/Entity/Group.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
#[ApiResource]
1313
#[ORM\Entity(repositoryClass: GroupRepository::class)]
14-
#[ORM\Table("'group'")]
14+
#[ORM\Table("`group`")]
1515
class Group
1616
{
1717
#[ORM\Id]

0 commit comments

Comments
 (0)