Skip to content

Commit 579766f

Browse files
committed
Require Composer's runtime API to be present
1 parent b4d1ec1 commit 579766f

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

ContainerBuilder.php

Lines 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)