Skip to content

Commit 4da6e4a

Browse files
committed
Bumping min php + symfony versions & removing legacy code
1 parent 826b4f2 commit 4da6e4a

File tree

56 files changed

+158
-1250
lines changed

Some content is hidden

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

56 files changed

+158
-1250
lines changed

.github/workflows/ci.yaml

Lines changed: 7 additions & 10 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'
9895
- '6.3.x-dev'
9996
- '6.4.x-dev'
10097
- '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: 15 additions & 16 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|^7.0",
20-
"symfony/console": "^5.4.7|^6.0|^7.0",
21-
"symfony/dependency-injection": "^5.4.7|^6.0|^7.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|^7.0",
24-
"symfony/finder": "^5.4.3|^6.0|^7.0",
25-
"symfony/framework-bundle": "^5.4.7|^6.0|^7.0",
26-
"symfony/http-kernel": "^5.4.7|^6.0|^7.0",
27-
"symfony/process": "^5.4.7|^6.0|^7.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|^7.0",
34-
"symfony/phpunit-bridge": "^5.4.17|^6.0|^7.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|^7.0",
37-
"symfony/yaml": "^5.4.3|^6.0|^7.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/" }

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/Maker/MakeAuthenticator.php

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
use Symfony\Bundle\MakerBundle\Util\YamlManipulationFailedException;
2929
use Symfony\Bundle\MakerBundle\Util\YamlSourceManipulator;
3030
use Symfony\Bundle\MakerBundle\Validator;
31-
use Symfony\Bundle\SecurityBundle\Security;
3231
use Symfony\Bundle\SecurityBundle\SecurityBundle;
3332
use Symfony\Bundle\TwigBundle\TwigBundle;
3433
use Symfony\Component\Console\Command\Command;
@@ -43,8 +42,6 @@
4342
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
4443
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
4544
use Symfony\Component\Security\Core\Exception\AuthenticationException;
46-
use Symfony\Component\Security\Core\Security as LegacySecurity;
47-
use Symfony\Component\Security\Guard\AuthenticatorInterface as GuardAuthenticatorInterface;
4845
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
4946
use Symfony\Component\Security\Http\Authenticator\AbstractAuthenticator;
5047
use Symfony\Component\Security\Http\Authenticator\AbstractLoginFormAuthenticator;
@@ -53,6 +50,7 @@
5350
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge;
5451
use Symfony\Component\Security\Http\Authenticator\Passport\Credentials\PasswordCredentials;
5552
use Symfony\Component\Security\Http\Authenticator\Passport\Passport;
53+
use Symfony\Component\Security\Http\SecurityRequestAttributes;
5654
use Symfony\Component\Security\Http\Util\TargetPathTrait;
5755
use Symfony\Component\Yaml\Yaml;
5856

@@ -103,11 +101,6 @@ public function interact(InputInterface $input, ConsoleStyle $io, Command $comma
103101
$manipulator = new YamlSourceManipulator($this->fileManager->getFileContents($path));
104102
$securityData = $manipulator->getData();
105103

106-
// @legacy - Can be removed when Symfony 5.4 support is dropped
107-
if (interface_exists(GuardAuthenticatorInterface::class) && !($securityData['security']['enable_authenticator_manager'] ?? false)) {
108-
throw new RuntimeCommandException('MakerBundle only supports the new authenticator based security system. See https://symfony.com/doc/current/security.html');
109-
}
110-
111104
// authenticator type
112105
$authenticatorTypeValues = [
113106
'Empty authenticator' => self::AUTH_TYPE_EMPTY_AUTHENTICATOR,
@@ -320,15 +313,9 @@ private function generateAuthenticatorClass(array $securityData, string $authent
320313
UserBadge::class,
321314
PasswordCredentials::class,
322315
TargetPathTrait::class,
316+
SecurityRequestAttributes::class,
323317
]);
324318

325-
// @legacy - Can be removed when Symfony 5.4 support is dropped
326-
if (class_exists(Security::class)) {
327-
$useStatements->addUseStatement(Security::class);
328-
} else {
329-
$useStatements->addUseStatement(LegacySecurity::class);
330-
}
331-
332319
if ($supportRememberMe) {
333320
$useStatements->addUseStatement(RememberMeBadge::class);
334321
}

0 commit comments

Comments
 (0)