Skip to content

Commit 9b54d75

Browse files
committed
Deprecate Composer 1
Signed-off-by: Alexander M. Turek <me@derrabus.de>
1 parent 4cb213e commit 9b54d75

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

ContainerBuilder.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1484,11 +1484,18 @@ public function log(CompilerPassInterface $pass, string $message)
14841484
*/
14851485
final public static function willBeAvailable(string $package, string $class, array $parentPackages): bool
14861486
{
1487+
$skipDeprecation = 3 < \func_num_args() && func_get_arg(3);
1488+
$hasRuntimeApi = class_exists(InstalledVersions::class);
1489+
1490+
if (!$hasRuntimeApi && !$skipDeprecation) {
1491+
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__);
1492+
}
1493+
14871494
if (!class_exists($class) && !interface_exists($class, false) && !trait_exists($class, false)) {
14881495
return false;
14891496
}
14901497

1491-
if (!class_exists(InstalledVersions::class) || !InstalledVersions::isInstalled($package) || InstalledVersions::isInstalled($package, false)) {
1498+
if (!$hasRuntimeApi || !InstalledVersions::isInstalled($package) || InstalledVersions::isInstalled($package, false)) {
14921499
return true;
14931500
}
14941501

0 commit comments

Comments
 (0)