Skip to content

Commit ab1bdf9

Browse files
committed
Deprecate Composer 1
Signed-off-by: Alexander M. Turek <me@derrabus.de>
1 parent 8f59196 commit ab1bdf9

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

DependencyInjection/SecurityExtension.php

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

1212
namespace Symfony\Bundle\SecurityBundle\DependencyInjection;
1313

14+
use Composer\InstalledVersions;
1415
use Symfony\Bridge\Twig\Extension\LogoutUrlExtension;
1516
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\AuthenticatorFactoryInterface;
1617
use Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\FirewallListenerFactoryInterface;
@@ -78,6 +79,10 @@ public function prepend(ContainerBuilder $container)
7879

7980
public function load(array $configs, ContainerBuilder $container)
8081
{
82+
if (!class_exists(InstalledVersions::class)) {
83+
trigger_deprecation('symfony/security-bundle', '5.4', 'Configuring Symfony without the Composer Runtime API is deprecated. Consider upgrading to Composer 2.');
84+
}
85+
8186
if (!array_filter($configs)) {
8287
return;
8388
}
@@ -120,7 +125,7 @@ public function load(array $configs, ContainerBuilder $container)
120125
$loader->load('security_legacy.php');
121126
}
122127

123-
if ($container::willBeAvailable('symfony/twig-bridge', LogoutUrlExtension::class, ['symfony/security-bundle'])) {
128+
if ($container::willBeAvailable('symfony/twig-bridge', LogoutUrlExtension::class, ['symfony/security-bundle'], true)) {
124129
$loader->load('templating_twig.php');
125130
}
126131

@@ -133,7 +138,7 @@ public function load(array $configs, ContainerBuilder $container)
133138
$loader->load('security_debug.php');
134139
}
135140

136-
if (!$container::willBeAvailable('symfony/expression-language', ExpressionLanguage::class, ['symfony/security-bundle'])) {
141+
if (!$container::willBeAvailable('symfony/expression-language', ExpressionLanguage::class, ['symfony/security-bundle'], true)) {
137142
$container->removeDefinition('security.expression_language');
138143
$container->removeDefinition('security.access.expression_voter');
139144
}
@@ -1005,7 +1010,7 @@ private function createExpression(ContainerBuilder $container, string $expressio
10051010
return $this->expressions[$id];
10061011
}
10071012

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

0 commit comments

Comments
 (0)