Skip to content

Commit b4eda56

Browse files
committed
feature #1356 Allow Symfony 7 + Drop old Symfony version support (nicolas-grekas, weaverryan)
This PR was merged into the 1.0-dev branch. Discussion ---------- Allow Symfony 7 + Drop old Symfony version support * PHP min version -> `8.1` * Symfony min version -> `6.3` * Drop support fully for annotations Commits ------- 4da6e4a Bumping min php + symfony versions & removing legacy code 826b4f2 Allow Symfony 7
2 parents 67e0e9f + 4da6e4a commit b4eda56

File tree

57 files changed

+162
-1253
lines changed

Some content is hidden

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

57 files changed

+162
-1253
lines changed

.github/workflows/ci.yaml

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
fail-fast: false
2323
matrix:
2424
php-version:
25-
- '8.0'
25+
- '8.1'
2626

2727
steps:
2828
-
@@ -92,22 +92,19 @@ jobs:
9292
php-version:
9393
- '8.2'
9494
symfony-version:
95-
- '5.4.*'
96-
- '5.4.x-dev'
97-
- '6.0.x-dev'
98-
- '6.1.x-dev'
99-
- '6.2.x-dev'
10095
- '6.3.x-dev'
96+
- '6.4.x-dev'
97+
- '7.0.x-dev'
10198
dependency-versions: ['highest']
10299
allow-dev-deps-in-apps: ['0']
103100
include:
104-
# testing lowest PHP version with LTS
105-
- php-version: '8.0.0'
106-
symfony-version: '5.4.*'
101+
# testing lowest PHP+dependencies with lowest Symfony
102+
- php-version: '8.1'
103+
symfony-version: '6.3.*'
107104
dependency-versions: 'lowest'
108-
# testing lowest php version with highest 5.x stable
109-
- php-version: '8.0.0'
110-
symfony-version: '5.4.*'
105+
# testing lowest PHP+dependencies with highest Symfony
106+
- php-version: '8.1'
107+
symfony-version: '6.3.*'
111108
dependency-versions: 'highest'
112109

113110
steps:

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ environment:
2727
TEST_DATABASE_DSN: mysql://root:[email protected]:3306/test_maker
2828
matrix:
2929
- dependencies: highest
30-
php_ver_target: 8.0.19
30+
php_ver_target: 8.1.23
3131

3232
install:
3333
- choco install sqlite --params "/NoTools"

composer.json

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,28 @@
1313
],
1414
"minimum-stability": "dev",
1515
"require": {
16-
"php": ">=8.0",
16+
"php": ">=8.1",
1717
"doctrine/inflector": "^2.0",
1818
"nikic/php-parser": "^4.11",
19-
"symfony/config": "^5.4.7|^6.0",
20-
"symfony/console": "^5.4.7|^6.0",
21-
"symfony/dependency-injection": "^5.4.7|^6.0",
19+
"symfony/config": "^6.3|^7.0",
20+
"symfony/console": "^6.3|^7.0",
21+
"symfony/dependency-injection": "^6.3|^7.0",
2222
"symfony/deprecation-contracts": "^2.2|^3",
23-
"symfony/filesystem": "^5.4.7|^6.0",
24-
"symfony/finder": "^5.4.3|^6.0",
25-
"symfony/framework-bundle": "^5.4.7|^6.0",
26-
"symfony/http-kernel": "^5.4.7|^6.0",
27-
"symfony/process": "^5.4.7|^6.0"
23+
"symfony/filesystem": "^6.3|^7.0",
24+
"symfony/finder": "^6.3|^7.0",
25+
"symfony/framework-bundle": "^6.3|^7.0",
26+
"symfony/http-kernel": "^6.3|^7.0",
27+
"symfony/process": "^6.3|^7.0"
2828
},
2929
"require-dev": {
3030
"composer/semver": "^3.0",
31-
"doctrine/doctrine-bundle": "^2.4",
31+
"doctrine/doctrine-bundle": "^2.4.3",
3232
"doctrine/orm": "^2.10.0",
33-
"symfony/http-client": "^5.4.7|^6.0",
34-
"symfony/phpunit-bridge": "^5.4.17|^6.0",
33+
"symfony/http-client": "^6.3|^7.0",
34+
"symfony/phpunit-bridge": "^6.3|^7.0",
3535
"symfony/polyfill-php80": "^1.16.0",
36-
"symfony/security-core": "^5.4.7|^6.0",
37-
"symfony/yaml": "^5.4.3|^6.0",
36+
"symfony/security-core": "^6.3|^7.0",
37+
"symfony/yaml": "^6.3|^7.0",
3838
"twig/twig": "^2.0|^3.0"
3939
},
4040
"config": {
@@ -43,8 +43,7 @@
4343
},
4444
"conflict": {
4545
"doctrine/orm": "<2.10",
46-
"doctrine/doctrine-bundle": "<2.4",
47-
"symfony/doctrine-bridge": "<5.4"
46+
"doctrine/doctrine-bundle": "<2.4"
4847
},
4948
"autoload": {
5049
"psr-4": { "Symfony\\Bundle\\MakerBundle\\": "src/" }
@@ -54,7 +53,7 @@
5453
},
5554
"extra": {
5655
"branch-alias": {
57-
"dev-main": "1.0-dev"
56+
"dev-main": "1.x-dev"
5857
}
5958
}
6059
}

src/Console/MigrationDiffFilteredOutput.php

Lines changed: 14 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -14,38 +14,7 @@
1414
use Symfony\Component\Console\Formatter\OutputFormatterInterface;
1515
use Symfony\Component\Console\Output\OutputInterface;
1616

17-
// look for the "string|iterable" type on OutputInterface::write()
18-
// @legacy - Use MigrationDiffFilteredOutput_php8 when Symfony 5.4 is no longer supported
19-
if (!(new \ReflectionMethod(OutputInterface::class, 'write'))->getParameters()[0]->getType()) {
20-
class MigrationDiffFilteredOutput implements OutputInterface
21-
{
22-
use BaseMakerMigrationDiffFilteredOuputTrait;
23-
24-
public function write($messages, $newline = false, $options = 0)
25-
{
26-
$this->_write($messages, $newline, $options);
27-
}
28-
29-
public function writeln($messages, $options = 0)
30-
{
31-
$this->_writeln($messages, $options);
32-
}
33-
34-
public function setVerbosity($level)
35-
{
36-
$this->output->setVerbosity($level);
37-
}
38-
39-
public function setDecorated($decorated)
40-
{
41-
$this->output->setDecorated($decorated);
42-
}
43-
}
44-
} else {
45-
require __DIR__.'/MigrationDiffFilteredOutput_php8';
46-
}
47-
48-
trait BaseMakerMigrationDiffFilteredOuputTrait
17+
class MigrationDiffFilteredOutput implements OutputInterface
4918
{
5019
private string $buffer = '';
5120
private bool $previousLineWasRemoved = false;
@@ -55,20 +24,30 @@ public function __construct(
5524
) {
5625
}
5726

58-
public function _write($messages, bool $newline = false, $options = 0)
27+
public function write($messages, bool $newline = false, $options = 0): void
5928
{
6029
$messages = $this->filterMessages($messages, $newline);
6130

6231
$this->output->write($messages, $newline, $options);
6332
}
6433

65-
public function _writeln($messages, int $options = 0)
34+
public function writeln($messages, int $options = 0): void
6635
{
6736
$messages = $this->filterMessages($messages, true);
6837

6938
$this->output->writeln($messages, $options);
7039
}
7140

41+
public function setVerbosity(int $level): void
42+
{
43+
$this->output->setVerbosity($level);
44+
}
45+
46+
public function setDecorated(bool $decorated): void
47+
{
48+
$this->output->setDecorated($decorated);
49+
}
50+
7251
public function getVerbosity(): int
7352
{
7453
return $this->output->getVerbosity();
@@ -99,7 +78,7 @@ public function isDecorated(): bool
9978
return $this->output->isDecorated();
10079
}
10180

102-
public function setFormatter(OutputFormatterInterface $formatter)
81+
public function setFormatter(OutputFormatterInterface $formatter): void
10382
{
10483
$this->output->setFormatter($formatter);
10584
}

src/Console/MigrationDiffFilteredOutput_php8

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

src/Doctrine/EntityClassGenerator.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ public function generateEntityClass(ClassNameDetails $entityClassDetails, bool $
5555
}
5656

5757
if ($apiResource) {
58-
// @legacy Drop annotation class when annotations are no longer supported.
59-
$useStatements->addUseStatement(class_exists(ApiResource::class) ? ApiResource::class : \ApiPlatform\Core\Annotation\ApiResource::class);
58+
$useStatements->addUseStatement(ApiResource::class);
6059
}
6160

6261
$entityPath = $this->generator->generateClass(

src/Doctrine/EntityDetails.php

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

1212
namespace Symfony\Bundle\MakerBundle\Doctrine;
1313

14-
use Doctrine\Common\Persistence\Mapping\ClassMetadata as LegacyClassMetadata;
1514
use Doctrine\Persistence\Mapping\ClassMetadata;
1615

1716
/**
@@ -22,7 +21,7 @@
2221
final class EntityDetails
2322
{
2423
public function __construct(
25-
private ClassMetadata|LegacyClassMetadata $metadata,
24+
private ClassMetadata $metadata,
2625
) {
2726
}
2827

src/Doctrine/EntityRegenerator.php

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

1212
namespace Symfony\Bundle\MakerBundle\Doctrine;
1313

14-
use Doctrine\Common\Persistence\Mapping\MappingException as LegacyCommonMappingException;
1514
use Doctrine\ORM\Mapping\ClassMetadata;
1615
use Doctrine\ORM\Mapping\MappingException;
1716
use Doctrine\Persistence\Mapping\MappingException as PersistenceMappingException;
@@ -38,7 +37,7 @@ public function regenerateEntities(string $classOrNamespace): void
3837
{
3938
try {
4039
$metadata = $this->doctrineHelper->getMetadata($classOrNamespace);
41-
} catch (MappingException|LegacyCommonMappingException|PersistenceMappingException) {
40+
} catch (MappingException|PersistenceMappingException) {
4241
$metadata = $this->doctrineHelper->getMetadata($classOrNamespace, true);
4342
}
4443

src/EventRegistry.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
use Symfony\Component\Console\Event\ConsoleCommandEvent;
1515
use Symfony\Component\Console\Event\ConsoleErrorEvent;
1616
use Symfony\Component\Console\Event\ConsoleTerminateEvent;
17-
use Symfony\Component\EventDispatcher\Event as LegacyEvent;
1817
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
1918
use Symfony\Component\HttpKernel\Event\ControllerArgumentsEvent;
2019
use Symfony\Component\HttpKernel\Event\ControllerEvent;
@@ -35,7 +34,6 @@
3534
use Symfony\Component\Security\Core\Event\AuthenticationSuccessEvent;
3635
use Symfony\Component\Security\Http\Event\InteractiveLoginEvent;
3736
use Symfony\Component\Security\Http\Event\SwitchUserEvent;
38-
use Symfony\Contracts\EventDispatcher\Event;
3937

4038
/**
4139
* @internal
@@ -148,11 +146,7 @@ public function getEventClassName(string $event): ?string
148146
}
149147

150148
if (null !== $type = $args[0]->getType()) {
151-
$type = $type instanceof \ReflectionNamedType ? $type->getName() : $type->__toString();
152-
153-
if (LegacyEvent::class === $type && class_exists(Event::class)) {
154-
return Event::class;
155-
}
149+
$type = $type instanceof \ReflectionNamedType ? $type->getName() : null;
156150

157151
// ignore an "object" type-hint
158152
if ('object' === $type) {

src/FileManager.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ private function realPath(string $absolutePath): string
194194
}
195195

196196
$finalPath = implode('/', $finalParts);
197+
197198
// Normalize: // => /
198199
// Normalize: /./ => /
199200
return str_replace(['//', '/./'], '/', $finalPath);

0 commit comments

Comments
 (0)