Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. AliasPackage.php

function AliasPackage::replaceSelfVersionDependencies

Parameters

Link[] $links:

Link::TYPE_* $linkType:

Return value

Link[]

6 calls to AliasPackage::replaceSelfVersionDependencies()
AliasPackage::__construct in vendor/composer/composer/src/Composer/Package/AliasPackage.php
All descendants' constructors should call this parent constructor
RootAliasPackage::setConflicts in vendor/composer/composer/src/Composer/Package/RootAliasPackage.php
@inheritDoc
RootAliasPackage::setDevRequires in vendor/composer/composer/src/Composer/Package/RootAliasPackage.php
@inheritDoc
RootAliasPackage::setProvides in vendor/composer/composer/src/Composer/Package/RootAliasPackage.php
@inheritDoc
RootAliasPackage::setReplaces in vendor/composer/composer/src/Composer/Package/RootAliasPackage.php
@inheritDoc

... See full list

File

vendor/composer/composer/src/Composer/Package/AliasPackage.php, line 182

Class

AliasPackage
@author Jordi Boggiano <j.boggiano@seld.be>

Namespace

Composer\Package

Code

protected function replaceSelfVersionDependencies(array $links, $linkType) : array {
    // for self.version requirements, we use the original package's branch name instead, to avoid leaking the magic dev-master-alias to users
    $prettyVersion = $this->prettyVersion;
    if ($prettyVersion === VersionParser::DEFAULT_BRANCH_ALIAS) {
        $prettyVersion = $this->aliasOf
            ->getPrettyVersion();
    }
    if (\in_array($linkType, [
        Link::TYPE_CONFLICT,
        Link::TYPE_PROVIDE,
        Link::TYPE_REPLACE,
    ], true)) {
        $newLinks = [];
        foreach ($links as $link) {
            // link is self.version, but must be replacing also the replaced version
            if ('self.version' === $link->getPrettyConstraint()) {
                $newLinks[] = new Link($link->getSource(), $link->getTarget(), $constraint = new Constraint('=', $this->version), $linkType, $prettyVersion);
                $constraint->setPrettyString($prettyVersion);
            }
        }
        $links = array_merge($links, $newLinks);
    }
    else {
        foreach ($links as $index => $link) {
            if ('self.version' === $link->getPrettyConstraint()) {
                if ($linkType === Link::TYPE_REQUIRE) {
                    $this->hasSelfVersionRequires = true;
                }
                $links[$index] = new Link($link->getSource(), $link->getTarget(), $constraint = new Constraint('=', $this->version), $linkType, $prettyVersion);
                $constraint->setPrettyString($prettyVersion);
            }
        }
    }
    return $links;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal