Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2cab2f5

Browse filesBrowse files
committed
Require Composer's runtime API to be present
Signed-off-by: Alexander M. Turek <me@derrabus.de>
1 parent b6df694 commit 2cab2f5
Copy full SHA for 2cab2f5

File tree

9 files changed

+44
-56
lines changed
Filter options

9 files changed

+44
-56
lines changed

‎composer.json

Copy file name to clipboardExpand all lines: composer.json
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
},
3434
"require": {
3535
"php": ">=8.0.2",
36+
"composer-runtime-api": ">=2.1",
3637
"ext-xml": "*",
3738
"friendsofphp/proxy-manager-lts": "^1.0.2",
3839
"doctrine/event-manager": "~1.0",

‎src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public function getConfigTreeBuilder(): TreeBuilder
122122
$parentPackages = (array) $parentPackage;
123123
$parentPackages[] = 'symfony/framework-bundle';
124124

125-
return ContainerBuilder::willBeAvailable($package, $class, $parentPackages, true);
125+
return ContainerBuilder::willBeAvailable($package, $class, $parentPackages);
126126
};
127127

128128
$enableIfStandalone = static function (string $package, string $class) use ($willBeAvailable) {

‎src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
+27-32Lines changed: 27 additions & 32 deletions
Large diffs are not rendered by default.

‎src/Symfony/Bundle/FrameworkBundle/composer.json

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/composer.json
+1Lines 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/cache": "^5.4|^6.0",
2223
"symfony/config": "^5.4|^6.0",

‎src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php
+3-8Lines 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;
@@ -72,10 +71,6 @@ public function prepend(ContainerBuilder $container)
7271

7372
public function load(array $configs, ContainerBuilder $container)
7473
{
75-
if (!class_exists(InstalledVersions::class)) {
76-
trigger_deprecation('symfony/security-bundle', '5.4', 'Configuring Symfony without the Composer Runtime API is deprecated. Consider upgrading to Composer 2.');
77-
}
78-
7974
if (!array_filter($configs)) {
8075
return;
8176
}
@@ -97,7 +92,7 @@ public function load(array $configs, ContainerBuilder $container)
9792

9893
$loader->load('security_authenticator.php');
9994

100-
if ($container::willBeAvailable('symfony/twig-bridge', LogoutUrlExtension::class, ['symfony/security-bundle'], true)) {
95+
if ($container::willBeAvailable('symfony/twig-bridge', LogoutUrlExtension::class, ['symfony/security-bundle'])) {
10196
$loader->load('templating_twig.php');
10297
}
10398

@@ -107,7 +102,7 @@ public function load(array $configs, ContainerBuilder $container)
107102
$loader->load('security_debug.php');
108103
}
109104

110-
if (!$container::willBeAvailable('symfony/expression-language', ExpressionLanguage::class, ['symfony/security-bundle'], true)) {
105+
if (!$container::willBeAvailable('symfony/expression-language', ExpressionLanguage::class, ['symfony/security-bundle'])) {
111106
$container->removeDefinition('security.expression_language');
112107
$container->removeDefinition('security.access.expression_voter');
113108
}
@@ -802,7 +797,7 @@ private function createExpression(ContainerBuilder $container, string $expressio
802797
return $this->expressions[$id];
803798
}
804799

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

‎src/Symfony/Bundle/SecurityBundle/composer.json

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/SecurityBundle/composer.json
+1Lines 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",

‎src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php
+4-9Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace Symfony\Bundle\TwigBundle\DependencyInjection;
1313

14-
use Composer\InstalledVersions;
1514
use Symfony\Component\Config\FileLocator;
1615
use Symfony\Component\Config\Resource\FileExistenceResource;
1716
use Symfony\Component\Console\Application;
@@ -36,26 +35,22 @@ class TwigExtension extends Extension
3635
{
3736
public function load(array $configs, ContainerBuilder $container)
3837
{
39-
if (!class_exists(InstalledVersions::class)) {
40-
trigger_deprecation('symfony/twig-bundle', '5.4', 'Configuring Symfony without the Composer Runtime API is deprecated. Consider upgrading to Composer 2.');
41-
}
42-
4338
$loader = new PhpFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
4439
$loader->load('twig.php');
4540

46-
if ($container::willBeAvailable('symfony/form', Form::class, ['symfony/twig-bundle'], true)) {
41+
if ($container::willBeAvailable('symfony/form', Form::class, ['symfony/twig-bundle'])) {
4742
$loader->load('form.php');
4843
}
4944

50-
if ($container::willBeAvailable('symfony/console', Application::class, ['symfony/twig-bundle'], true)) {
45+
if ($container::willBeAvailable('symfony/console', Application::class, ['symfony/twig-bundle'])) {
5146
$loader->load('console.php');
5247
}
5348

54-
if ($container::willBeAvailable('symfony/mailer', Mailer::class, ['symfony/twig-bundle'], true)) {
49+
if ($container::willBeAvailable('symfony/mailer', Mailer::class, ['symfony/twig-bundle'])) {
5550
$loader->load('mailer.php');
5651
}
5752

58-
if (!$container::willBeAvailable('symfony/translation', Translator::class, ['symfony/twig-bundle'], true)) {
53+
if (!$container::willBeAvailable('symfony/translation', Translator::class, ['symfony/twig-bundle'])) {
5954
$container->removeDefinition('twig.translation.extractor');
6055
}
6156

‎src/Symfony/Bundle/TwigBundle/composer.json

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/TwigBundle/composer.json
+1Lines 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
"symfony/config": "^5.4|^6.0",
2122
"symfony/twig-bridge": "^5.4|^6.0",
2223
"symfony/http-foundation": "^5.4|^6.0",

‎src/Symfony/Component/DependencyInjection/ContainerBuilder.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/ContainerBuilder.php
+5-6Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1409,21 +1409,20 @@ public function log(CompilerPassInterface $pass, string $message)
14091409
*
14101410
* When parent packages are provided and if any of them is in dev-only mode,
14111411
* the class will be considered available even if it is also in dev-only mode.
1412+
*
1413+
* @throws \LogicException If dependencies have been installed with Composer 1
14121414
*/
14131415
final public static function willBeAvailable(string $package, string $class, array $parentPackages): bool
14141416
{
1415-
$skipDeprecation = 3 < \func_num_args() && func_get_arg(3);
1416-
$hasRuntimeApi = class_exists(InstalledVersions::class);
1417-
1418-
if (!$hasRuntimeApi && !$skipDeprecation) {
1419-
trigger_deprecation('symfony/dependency-injection', '5.4', 'Calling "%s" when dependencies have been installed with Composer 1 is deprecated. Consider upgrading to Composer 2.', __METHOD__);
1417+
if (!class_exists(InstalledVersions::class)) {
1418+
throw new \LogicException(sprintf('Calling "%s" when dependencies have been installed with Composer 1 is not supported. Consider upgrading to Composer 2.', __METHOD__));
14201419
}
14211420

14221421
if (!class_exists($class) && !interface_exists($class, false) && !trait_exists($class, false)) {
14231422
return false;
14241423
}
14251424

1426-
if (!$hasRuntimeApi || !InstalledVersions::isInstalled($package) || InstalledVersions::isInstalled($package, false)) {
1425+
if (!InstalledVersions::isInstalled($package) || InstalledVersions::isInstalled($package, false)) {
14271426
return true;
14281427
}
14291428

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.