Skip to content

Commit 2f3f538

Browse files
nicolas-grekasfabpot
authored andcommitted
Bump minimum version of PHP to 8.1
1 parent 3d2fe3e commit 2f3f538

15 files changed

+14
-40
lines changed

Command/ConfigDebugCommand.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ private function compileContainer(): ContainerBuilder
127127
$kernel->boot();
128128

129129
$method = new \ReflectionMethod($kernel, 'buildContainer');
130-
$method->setAccessible(true);
131130
$container = $method->invoke($kernel);
132131
$container->getCompiler()->compile($container);
133132

Command/ContainerDebugCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
132132
$options = ['env-vars' => true, 'name' => $envVar];
133133
} elseif ($input->getOption('types')) {
134134
$options = [];
135-
$options['filter'] = [$this, 'filterToServiceTypes'];
135+
$options['filter'] = $this->filterToServiceTypes(...);
136136
} elseif ($input->getOption('parameters')) {
137137
$parameters = [];
138138
foreach ($object->getParameterBag()->all() as $k => $v) {

Command/ContainerLintCommand.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ private function getContainerBuilder(): ContainerBuilder
104104
(new XmlFileLoader($container = new ContainerBuilder($parameterBag = new EnvPlaceholderParameterBag()), new FileLocator()))->load($kernelContainer->getParameter('debug.container.dump'));
105105

106106
$refl = new \ReflectionProperty($parameterBag, 'resolved');
107-
$refl->setAccessible(true);
108107
$refl->setValue($parameterBag, true);
109108

110109
$skippedIds = [];

Command/DebugAutowiringCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
7878

7979
$builder = $this->getContainerBuilder($this->getApplication()->getKernel());
8080
$serviceIds = $builder->getServiceIds();
81-
$serviceIds = array_filter($serviceIds, [$this, 'filterToServiceTypes']);
81+
$serviceIds = array_filter($serviceIds, $this->filterToServiceTypes(...));
8282

8383
if ($search = $input->getArgument('search')) {
8484
$searchNormalized = preg_replace('/[^a-zA-Z0-9\x7f-\xff $]++/', '', $search);
@@ -169,7 +169,7 @@ public function complete(CompletionInput $input, CompletionSuggestions $suggesti
169169
if ($input->mustSuggestArgumentValuesFor('search')) {
170170
$builder = $this->getContainerBuilder($this->getApplication()->getKernel());
171171

172-
$suggestions->suggestValues(array_filter($builder->getServiceIds(), [$this, 'filterToServiceTypes']));
172+
$suggestions->suggestValues(array_filter($builder->getServiceIds(), $this->filterToServiceTypes(...)));
173173
}
174174
}
175175
}

Console/Descriptor/Descriptor.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,6 @@ private function getContainerEnvVars(ContainerBuilder $container): array
326326
$getDefaultParameter = $getDefaultParameter->bindTo($bag, \get_class($bag));
327327

328328
$getEnvReflection = new \ReflectionMethod($container, 'getEnv');
329-
$getEnvReflection->setAccessible(true);
330329

331330
$envs = [];
332331

DependencyInjection/FrameworkExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ public function load(array $configs, ContainerBuilder $container)
248248

249249
$loader->load('web.php');
250250

251-
if (\PHP_VERSION_ID < 80100 || !class_exists(BackedEnumValueResolver::class)) {
251+
if (!class_exists(BackedEnumValueResolver::class)) {
252252
$container->removeDefinition('argument_resolver.backed_enum_resolver');
253253
}
254254

Routing/Router.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ public function __construct(ContainerInterface $container, mixed $resource, arra
4949
$this->setOptions($options);
5050

5151
if ($parameters) {
52-
$this->paramFetcher = \Closure::fromCallable([$parameters, 'get']);
52+
$this->paramFetcher = $parameters->get(...);
5353
} elseif ($container instanceof SymfonyContainerInterface) {
54-
$this->paramFetcher = \Closure::fromCallable([$container, 'getParameter']);
54+
$this->paramFetcher = $container->getParameter(...);
5555
} else {
5656
throw new \LogicException(sprintf('You should either pass a "%s" instance or provide the $parameters argument of the "%s" method.', SymfonyContainerInterface::class, __METHOD__));
5757
}

Tests/CacheWarmer/AnnotationsCacheWarmerTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,7 @@ public function testWarmupRemoveCacheMisses()
151151
$this->assertTrue(isset($data[0]['bar_hit']));
152152
}
153153

154-
/**
155-
* @return MockObject&Reader
156-
*/
157-
private function getReadOnlyReader(): Reader
154+
private function getReadOnlyReader(): MockObject&Reader
158155
{
159156
$readerMock = $this->createMock(Reader::class);
160157
$readerMock->expects($this->exactly(0))->method('getClassAnnotations');

Tests/Command/CachePoolClearCommandTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,7 @@ public function provideCompletionSuggestions()
5252
];
5353
}
5454

55-
/**
56-
* @return MockObject&KernelInterface
57-
*/
58-
private function getKernel(): KernelInterface
55+
private function getKernel(): MockObject&KernelInterface
5956
{
6057
$container = $this->createMock(ContainerInterface::class);
6158

Tests/Command/CachePoolDeleteCommandTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,7 @@ public function provideCompletionSuggestions()
106106
];
107107
}
108108

109-
/**
110-
* @return MockObject&KernelInterface
111-
*/
112-
private function getKernel(): KernelInterface
109+
private function getKernel(): MockObject&KernelInterface
113110
{
114111
$container = $this->createMock(ContainerInterface::class);
115112

Tests/Command/CachePruneCommandTest.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,7 @@ private function getEmptyRewindableGenerator(): RewindableGenerator
5050
}, 0);
5151
}
5252

53-
/**
54-
* @return MockObject&KernelInterface
55-
*/
56-
private function getKernel(): KernelInterface
53+
private function getKernel(): MockObject&KernelInterface
5754
{
5855
$container = $this->createMock(ContainerInterface::class);
5956

@@ -71,10 +68,7 @@ private function getKernel(): KernelInterface
7168
return $kernel;
7269
}
7370

74-
/**
75-
* @return MockObject&PruneableInterface
76-
*/
77-
private function getPruneableInterfaceMock(): PruneableInterface
71+
private function getPruneableInterfaceMock(): MockObject&PruneableInterface
7872
{
7973
$pruneable = $this->createMock(PruneableInterface::class);
8074
$pruneable

Tests/Console/Descriptor/AbstractDescriptorTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,7 @@ public function getDescribeContainerDefinitionWithArgumentsShownTestData()
122122
$definitionsWithArgs[str_replace('definition_', 'definition_arguments_', $key)] = $definition;
123123
}
124124

125-
if (\PHP_VERSION_ID >= 80100) {
126-
$definitionsWithArgs['definition_arguments_with_enum'] = (new Definition('definition_with_enum'))->setArgument(0, FooUnitEnum::FOO);
127-
}
125+
$definitionsWithArgs['definition_arguments_with_enum'] = (new Definition('definition_with_enum'))->setArgument(0, FooUnitEnum::FOO);
128126

129127
return $this->getDescriptionTestData($definitionsWithArgs);
130128
}

Tests/Console/Descriptor/ObjectsProvider.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,6 @@ public static function getContainerParameters()
7171
'array' => [12, 'Hello world!', true],
7272
]);
7373

74-
if (\PHP_VERSION_ID < 80100) {
75-
return;
76-
}
77-
7874
yield 'parameters_enums' => new ParameterBag([
7975
'unit_enum' => FooUnitEnum::BAR,
8076
'backed_enum' => Suit::Hearts,
@@ -259,7 +255,7 @@ public static function getCallables()
259255
'callable_5' => ['Symfony\\Bundle\\FrameworkBundle\\Tests\\Console\\Descriptor\\ExtendedCallableClass', 'parent::staticMethod'],
260256
'callable_6' => function () { return 'Closure'; },
261257
'callable_7' => new CallableClass(),
262-
'callable_from_callable' => \Closure::fromCallable(new CallableClass()),
258+
'callable_from_callable' => (new CallableClass())(...),
263259
];
264260
}
265261
}

Tests/Functional/CachePoolClearCommandTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ public function testClearFailed()
8686
$pool->save($item);
8787
$r = new \ReflectionObject($pool);
8888
$p = $r->getProperty('directory');
89-
$p->setAccessible(true);
9089
$poolDir = $p->getValue($pool);
9190

9291
/** @var SplFileInfo $entry */

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
}
1717
],
1818
"require": {
19-
"php": ">=8.0.2",
19+
"php": ">=8.1",
2020
"composer-runtime-api": ">=2.1",
2121
"ext-xml": "*",
2222
"symfony/cache": "^5.4|^6.0",
@@ -27,7 +27,6 @@
2727
"symfony/http-foundation": "^5.4|^6.0",
2828
"symfony/http-kernel": "^5.4|^6.0",
2929
"symfony/polyfill-mbstring": "~1.0",
30-
"symfony/polyfill-php81": "^1.22",
3130
"symfony/filesystem": "^5.4|^6.0",
3231
"symfony/finder": "^5.4|^6.0",
3332
"symfony/routing": "^5.4|^6.0"

0 commit comments

Comments
 (0)