Skip to content

Commit cabeea3

Browse files
authored
drop PHP 7.x support (#1122)
1 parent e3f9a1d commit cabeea3

File tree

57 files changed

+128
-1257
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

+128
-1257
lines changed

.github/workflows/ci.yaml

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

2727
steps:
2828
-
@@ -99,11 +99,11 @@ jobs:
9999
allow-dev-deps-in-apps: ['0']
100100
include:
101101
# testing lowest PHP version with LTS
102-
- php-version: '7.2.5'
102+
- php-version: '8.0.0'
103103
symfony-version: '5.4.*'
104104
dependency-versions: 'lowest'
105105
# testing lowest php version with highest 5.x stable
106-
- php-version: '7.2.5'
106+
- php-version: '8.0.0'
107107
symfony-version: '5.4.*'
108108
dependency-versions: 'highest'
109109
# testing bleeding edge PHP with highest 5.x stable

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: 7.2.5
30+
php_ver_target: 8.0.19
3131

3232
install:
3333
- ps: Set-Service wuauserv -StartupType Manual

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
],
1414
"minimum-stability": "dev",
1515
"require": {
16-
"php": ">=7.2.5",
16+
"php": ">=8.0",
1717
"doctrine/inflector": "^2.0",
1818
"nikic/php-parser": "^4.11",
1919
"symfony/config": "^5.4.7|^6.0",

src/Command/MakerCommand.php

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,13 @@
3232
*/
3333
final class MakerCommand extends Command
3434
{
35-
private $maker;
36-
private $fileManager;
37-
private $inputConfig;
38-
/** @var ConsoleStyle */
39-
private $io;
40-
private $checkDependencies = true;
41-
private $generator;
42-
43-
public function __construct(MakerInterface $maker, FileManager $fileManager, Generator $generator)
35+
private InputConfiguration $inputConfig;
36+
private ConsoleStyle $io;
37+
private bool $checkDependencies = true;
38+
39+
public function __construct(private MakerInterface $maker, private FileManager $fileManager, private Generator $generator)
4440
{
45-
$this->maker = $maker;
46-
$this->fileManager = $fileManager;
4741
$this->inputConfig = new InputConfiguration();
48-
$this->generator = $generator;
4942

5043
parent::__construct();
5144
}

src/Doctrine/DoctrineHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ public function doesClassUsesAttributes(string $className): bool
145145

146146
public function isDoctrineSupportingAttributes(): bool
147147
{
148-
return $this->isDoctrineInstalled() && $this->attributeMappingSupport && $this->phpCompatUtil->canUseAttributes();
148+
return $this->isDoctrineInstalled() && $this->attributeMappingSupport;
149149
}
150150

151151
public function getEntitiesForAutocomplete(): array

src/Generator.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,6 @@ private function addOperation(string $targetPath, string $templateName, array $v
170170
}
171171

172172
$variables['relative_path'] = $this->fileManager->relativizePath($targetPath);
173-
$variables['use_attributes'] = $this->phpCompatUtil->canUseAttributes();
174-
$variables['use_typed_properties'] = $this->phpCompatUtil->canUseTypedProperties();
175-
$variables['use_union_types'] = $this->phpCompatUtil->canUseUnionTypes();
176173

177174
$templatePath = $templateName;
178175
if (!file_exists($templatePath)) {

src/Maker/MakeAuthenticator.php

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,13 @@ final class MakeAuthenticator extends AbstractMaker
6565
private const AUTH_TYPE_EMPTY_AUTHENTICATOR = 'empty-authenticator';
6666
private const AUTH_TYPE_FORM_LOGIN = 'form-login';
6767

68-
private $fileManager;
69-
private $configUpdater;
70-
private $generator;
71-
private $doctrineHelper;
72-
private $securityControllerBuilder;
73-
74-
public function __construct(FileManager $fileManager, SecurityConfigUpdater $configUpdater, Generator $generator, DoctrineHelper $doctrineHelper, SecurityControllerBuilder $securityControllerBuilder)
75-
{
76-
$this->fileManager = $fileManager;
77-
$this->configUpdater = $configUpdater;
78-
$this->generator = $generator;
79-
$this->doctrineHelper = $doctrineHelper;
80-
$this->securityControllerBuilder = $securityControllerBuilder;
68+
public function __construct(
69+
private FileManager $fileManager,
70+
private SecurityConfigUpdater $configUpdater,
71+
private Generator $generator,
72+
private DoctrineHelper $doctrineHelper,
73+
private SecurityControllerBuilder $securityControllerBuilder
74+
) {
8175
}
8276

8377
public static function getCommandName(): string

src/Maker/MakeCommand.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,8 @@
3333
*/
3434
final class MakeCommand extends AbstractMaker
3535
{
36-
private $phpCompatUtil;
37-
38-
public function __construct(PhpCompatUtil $phpCompatUtil)
36+
public function __construct(private PhpCompatUtil $phpCompatUtil)
3937
{
40-
$this->phpCompatUtil = $phpCompatUtil;
4138
}
4239

4340
public static function getCommandName(): string
@@ -77,12 +74,9 @@ public function generate(InputInterface $input, ConsoleStyle $io, Generator $gen
7774
InputOption::class,
7875
OutputInterface::class,
7976
SymfonyStyle::class,
77+
AsCommand::class,
8078
]);
8179

82-
if ($this->phpCompatUtil->canUseAttributes()) {
83-
$useStatements->addUseStatement(AsCommand::class);
84-
}
85-
8680
$generator->generateClass(
8781
$commandClassNameDetails->getFullName(),
8882
'command/Command.tpl.php',

src/Maker/MakeController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
*/
3737
final class MakeController extends AbstractMaker
3838
{
39-
private $phpCompatUtil;
39+
private PhpCompatUtil $phpCompatUtil;
4040

4141
public function __construct(PhpCompatUtil $phpCompatUtil = null)
4242
{
@@ -116,7 +116,7 @@ public function generate(InputInterface $input, ConsoleStyle $io, Generator $gen
116116
public function configureDependencies(DependencyBuilder $dependencies): void
117117
{
118118
// @legacy - Remove method when support for Symfony 5.4 is dropped
119-
if (null !== $this->phpCompatUtil && 60000 <= Kernel::VERSION_ID && $this->phpCompatUtil->canUseAttributes()) {
119+
if (null !== $this->phpCompatUtil && 60000 <= Kernel::VERSION_ID) {
120120
return;
121121
}
122122

src/Maker/MakeCrud.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Bundle\MakerBundle\Maker;
1313

1414
use Doctrine\Bundle\DoctrineBundle\DoctrineBundle;
15+
use Doctrine\Inflector\Inflector;
1516
use Doctrine\Inflector\InflectorFactory;
1617
use Doctrine\ORM\EntityManagerInterface;
1718
use Doctrine\ORM\EntityRepository;
@@ -45,16 +46,12 @@
4546
*/
4647
final class MakeCrud extends AbstractMaker
4748
{
48-
private $doctrineHelper;
49-
private $formTypeRenderer;
50-
private $inflector;
51-
private $controllerClassName;
52-
private $generateTests = false;
49+
private Inflector $inflector;
50+
private string $controllerClassName;
51+
private bool $generateTests = false;
5352

54-
public function __construct(DoctrineHelper $doctrineHelper, FormTypeRenderer $formTypeRenderer)
53+
public function __construct(private DoctrineHelper $doctrineHelper, private FormTypeRenderer $formTypeRenderer)
5554
{
56-
$this->doctrineHelper = $doctrineHelper;
57-
$this->formTypeRenderer = $formTypeRenderer;
5855
$this->inflector = InflectorFactory::create()->build();
5956
}
6057

src/Maker/MakeEntity.php

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,23 +45,18 @@
4545
*/
4646
final class MakeEntity extends AbstractMaker implements InputAwareMakerInterface
4747
{
48-
private $fileManager;
49-
private $doctrineHelper;
50-
private $generator;
51-
private $entityClassGenerator;
52-
private $phpCompatUtil;
48+
private Generator $generator;
49+
private EntityClassGenerator $entityClassGenerator;
50+
private PhpCompatUtil $phpCompatUtil;
5351

5452
public function __construct(
55-
FileManager $fileManager,
56-
DoctrineHelper $doctrineHelper,
53+
private FileManager $fileManager,
54+
private DoctrineHelper $doctrineHelper,
5755
string $projectDirectory = null,
5856
Generator $generator = null,
5957
EntityClassGenerator $entityClassGenerator = null,
6058
PhpCompatUtil $phpCompatUtil = null
6159
) {
62-
$this->fileManager = $fileManager;
63-
$this->doctrineHelper = $doctrineHelper;
64-
6560
if (null !== $projectDirectory) {
6661
@trigger_error('The $projectDirectory constructor argument is no longer used since 1.41.0', \E_USER_DEPRECATED);
6762
}
@@ -877,10 +872,6 @@ private function doesEntityUseAnnotationMapping(string $className): bool
877872
/** @legacy Drop when Annotations are no longer supported */
878873
private function doesEntityUseAttributeMapping(string $className): bool
879874
{
880-
if (!$this->phpCompatUtil->canUseAttributes()) {
881-
return false;
882-
}
883-
884875
if (!class_exists($className)) {
885876
$otherClassMetadatas = $this->doctrineHelper->getMetadata(Str::getNamespace($className).'\\', true);
886877

src/Maker/MakeForm.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,8 @@
3434
*/
3535
final class MakeForm extends AbstractMaker
3636
{
37-
private $entityHelper;
38-
private $formTypeRenderer;
39-
40-
public function __construct(DoctrineHelper $entityHelper, FormTypeRenderer $formTypeRenderer)
37+
public function __construct(private DoctrineHelper $entityHelper, private FormTypeRenderer $formTypeRenderer)
4138
{
42-
$this->entityHelper = $entityHelper;
43-
$this->formTypeRenderer = $formTypeRenderer;
4439
}
4540

4641
public static function getCommandName(): string

src/Maker/MakeMessage.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,8 @@
3232
*/
3333
final class MakeMessage extends AbstractMaker
3434
{
35-
private $fileManager;
36-
37-
public function __construct(FileManager $fileManager)
35+
public function __construct(private FileManager $fileManager)
3836
{
39-
$this->fileManager = $fileManager;
4037
}
4138

4239
public static function getCommandName(): string

src/Maker/MakeMigration.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,10 @@
3131
*/
3232
final class MakeMigration extends AbstractMaker implements ApplicationAwareMakerInterface
3333
{
34-
private $projectDir;
34+
private Application $application;
3535

36-
/**
37-
* @var Application
38-
*/
39-
private $application;
40-
41-
public function __construct(string $projectDir)
36+
public function __construct(private string $projectDir)
4237
{
43-
$this->projectDir = $projectDir;
4438
}
4539

4640
public static function getCommandName(): string

src/Maker/MakeRegistrationForm.php

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,6 @@
6767
*/
6868
final class MakeRegistrationForm extends AbstractMaker
6969
{
70-
private $fileManager;
71-
private $formTypeRenderer;
72-
private $router;
73-
private $doctrineHelper;
74-
7570
private $userClass;
7671
private $usernameField;
7772
private $passwordField;
@@ -87,12 +82,12 @@ final class MakeRegistrationForm extends AbstractMaker
8782
private $addUniqueEntityConstraint;
8883
private $useNewAuthenticatorSystem = false;
8984

90-
public function __construct(FileManager $fileManager, FormTypeRenderer $formTypeRenderer, RouterInterface $router, DoctrineHelper $doctrineHelper)
91-
{
92-
$this->fileManager = $fileManager;
93-
$this->formTypeRenderer = $formTypeRenderer;
94-
$this->router = $router;
95-
$this->doctrineHelper = $doctrineHelper;
85+
public function __construct(
86+
private FileManager $fileManager,
87+
private FormTypeRenderer $formTypeRenderer,
88+
private RouterInterface $router,
89+
private DoctrineHelper $doctrineHelper
90+
) {
9691
}
9792

9893
public static function getCommandName(): string

src/Maker/MakeResetPassword.php

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -78,23 +78,19 @@
7878
*/
7979
class MakeResetPassword extends AbstractMaker
8080
{
81-
private $fileManager;
82-
private $doctrineHelper;
83-
private $entityClassGenerator;
84-
85-
private $fromEmailAddress;
86-
private $fromEmailName;
87-
private $controllerResetSuccessRedirect;
88-
private $userClass;
89-
private $emailPropertyName;
90-
private $emailGetterMethodName;
91-
private $passwordSetterMethodName;
92-
93-
public function __construct(FileManager $fileManager, DoctrineHelper $doctrineHelper, EntityClassGenerator $entityClassGenerator)
94-
{
95-
$this->fileManager = $fileManager;
96-
$this->doctrineHelper = $doctrineHelper;
97-
$this->entityClassGenerator = $entityClassGenerator;
81+
private string $fromEmailAddress;
82+
private string $fromEmailName;
83+
private string $controllerResetSuccessRedirect;
84+
private string $userClass;
85+
private string $emailPropertyName;
86+
private string $emailGetterMethodName;
87+
private string $passwordSetterMethodName;
88+
89+
public function __construct(
90+
private FileManager $fileManager,
91+
private DoctrineHelper $doctrineHelper,
92+
private EntityClassGenerator $entityClassGenerator
93+
) {
9894
}
9995

10096
public static function getCommandName(): string

src/Maker/MakeSubscriber.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,8 @@
3131
*/
3232
final class MakeSubscriber extends AbstractMaker
3333
{
34-
private $eventRegistry;
35-
36-
public function __construct(EventRegistry $eventRegistry)
34+
public function __construct(private EventRegistry $eventRegistry)
3735
{
38-
$this->eventRegistry = $eventRegistry;
3936
}
4037

4138
public static function getCommandName(): string

src/Maker/MakeUser.php

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,13 @@
4848
*/
4949
final class MakeUser extends AbstractMaker
5050
{
51-
private $fileManager;
52-
private $userClassBuilder;
53-
private $configUpdater;
54-
private $entityClassGenerator;
55-
private $doctrineHelper;
56-
57-
public function __construct(FileManager $fileManager, UserClassBuilder $userClassBuilder, SecurityConfigUpdater $configUpdater, EntityClassGenerator $entityClassGenerator, DoctrineHelper $doctrineHelper)
58-
{
59-
$this->fileManager = $fileManager;
60-
$this->userClassBuilder = $userClassBuilder;
61-
$this->configUpdater = $configUpdater;
62-
$this->entityClassGenerator = $entityClassGenerator;
63-
$this->doctrineHelper = $doctrineHelper;
51+
public function __construct(
52+
private FileManager $fileManager,
53+
private UserClassBuilder $userClassBuilder,
54+
private SecurityConfigUpdater $configUpdater,
55+
private EntityClassGenerator $entityClassGenerator,
56+
private DoctrineHelper $doctrineHelper
57+
) {
6458
}
6559

6660
public static function getCommandName(): string

src/Resources/skeleton/authenticator/LoginFormAuthenticator.tpl.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,8 @@ class <?= $class_name; ?> extends AbstractLoginFormAuthenticator
1010

1111
public const LOGIN_ROUTE = 'app_login';
1212

13-
private <?= $use_typed_properties ? 'UrlGeneratorInterface ' : null ?>$urlGenerator;
14-
15-
public function __construct(UrlGeneratorInterface $urlGenerator)
13+
public function __construct(private UrlGeneratorInterface $urlGenerator)
1614
{
17-
$this->urlGenerator = $urlGenerator;
1815
}
1916

2017
public function authenticate(Request $request): Passport

0 commit comments

Comments
 (0)