Skip to content

Commit 755657b

Browse files
committed
Require Composer's runtime API to be present
1 parent edffac8 commit 755657b

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

DependencyInjection/SecurityExtension.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace Symfony\Bundle\SecurityBundle\DependencyInjection;
1313

14-
use Composer\InstalledVersions;
1514
use Symfony\Bridge\Twig\Extension\LogoutUrlExtension;
1615
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\AuthenticatorFactoryInterface;
1716
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\FirewallListenerFactoryInterface;
@@ -76,10 +75,6 @@ public function prepend(ContainerBuilder $container)
7675

7776
public function load(array $configs, ContainerBuilder $container)
7877
{
79-
if (!class_exists(InstalledVersions::class)) {
80-
trigger_deprecation('symfony/security-bundle', '5.4', 'Configuring Symfony without the Composer Runtime API is deprecated. Consider upgrading to Composer 2.1 or later.');
81-
}
82-
8378
if (!array_filter($configs)) {
8479
return;
8580
}
@@ -101,7 +96,7 @@ public function load(array $configs, ContainerBuilder $container)
10196

10297
$loader->load('security_authenticator.php');
10398

104-
if ($container::willBeAvailable('symfony/twig-bridge', LogoutUrlExtension::class, ['symfony/security-bundle'], true)) {
99+
if ($container::willBeAvailable('symfony/twig-bridge', LogoutUrlExtension::class, ['symfony/security-bundle'])) {
105100
$loader->load('templating_twig.php');
106101
}
107102

@@ -111,7 +106,7 @@ public function load(array $configs, ContainerBuilder $container)
111106
$loader->load('security_debug.php');
112107
}
113108

114-
if (!$container::willBeAvailable('symfony/expression-language', ExpressionLanguage::class, ['symfony/security-bundle'], true)) {
109+
if (!$container::willBeAvailable('symfony/expression-language', ExpressionLanguage::class, ['symfony/security-bundle'])) {
115110
$container->removeDefinition('security.expression_language');
116111
$container->removeDefinition('security.access.expression_voter');
117112
}
@@ -831,7 +826,7 @@ private function createExpression(ContainerBuilder $container, string $expressio
831826
return $this->expressions[$id];
832827
}
833828

834-
if (!$container::willBeAvailable('symfony/expression-language', ExpressionLanguage::class, ['symfony/security-bundle'], true)) {
829+
if (!$container::willBeAvailable('symfony/expression-language', ExpressionLanguage::class, ['symfony/security-bundle'])) {
835830
throw new \RuntimeException('Unable to use expressions as the Symfony ExpressionLanguage component is not installed. Try running "composer require symfony/expression-language".');
836831
}
837832

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
],
1818
"require": {
1919
"php": ">=8.0.2",
20+
"composer-runtime-api": ">=2.1",
2021
"ext-xml": "*",
2122
"symfony/config": "^5.4|^6.0",
2223
"symfony/dependency-injection": "^5.4|^6.0",

0 commit comments

Comments
 (0)