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

0 commit comments

Comments
 (0)