protected function replaceSelfVersionDependencies(
        $type,
        array $links,
        RootPackageInterface $root
    ) {
        $linkType = BasePackage::$supportedLinkTypes[$type];
        $version = $root->getVersion();
        $prettyVersion = $root->getPrettyVersion();
        $vp = $this->versionParser;

        $method = 'get' . ucfirst($linkType['method']);
        $packages = $root->$method();

        return array_map(
            function ($link) use ($linkType, $version, $prettyVersion, $vp, $packages) {
                if ('self.version' === $link->getPrettyConstraint()) {
                    if (isset($packages[$link->getSource()])) {
                        /** @var Link $package */
                        $package = $packages[$link->getSource()];
                        return new Link(
                            $link->getSource(),
                            $link->getTarget(),
                            $vp->parseConstraints($package->getConstraint()->getPrettyString()),
                            $linkType['description'],
                            $package->getPrettyConstraint()
                        );
                    }

                    return new Link(
                        $link->getSource(),
                        $link->getTarget(),
                        $vp->parseConstraints($version),
                        $linkType['description'],
                        $prettyVersion
                    );
                }
                return $link;
            },
            $links
        );
    }
protected function replaceSelfVersionDependencies(
        $type,
        array $links,
        RootPackageInterface $root
    ) {
        $linkType = BasePackage::$supportedLinkTypes[$type];
        $version = $root->getVersion();
        $prettyVersion = $root->getPrettyVersion();
        $vp = $this->versionParser;

        $method = 'get' . ucfirst($linkType['method']);
        $packages = $root->$method();

        return array_map(
            function ($link) use ($linkType, $version, $prettyVersion, $vp, $packages) {
                if ('self.version' === $link->getPrettyConstraint()) {
                    if (isset($packages[$link->getSource()])) {
                        /** @var Link $package */
                        $package = $packages[$link->getSource()];
                        return new Link(
                            $link->getSource(),
                            $link->getTarget(),
                            $vp->parseConstraints($package->getConstraint()->getPrettyString()),
                            $linkType['description'],
                            $package->getPrettyConstraint()
                        );
                    }

                    return new Link(
                        $link->getSource(),
                        $link->getTarget(),
                        $vp->parseConstraints($version),
                        $linkType['description'],
                        $prettyVersion
                    );
                }
                return $link;
            },
            $links
        );
    }
protected function replaceSelfVersionDependencies ( $ type , array $ links , RootPackageInterface $ root ) { $ linkType = BasePackage :: $ supportedLinkTypes [ $ type ] ; $ version = $ root -> getVersion ( ) ; $ prettyVersion = $ root -> getPrettyVersion ( ) ; $ vp = $ this -> versionParser ; $ method = 'get' . ucfirst ( $ linkType [ 'method' ] ) ; $ packages = $ root -> $ method ( ) ; return array_map ( function ( $ link ) use ( $ linkType , $ version , $ prettyVersion , $ vp , $ packages ) { if ( 'self.version' === $ link -> getPrettyConstraint ( ) ) { if ( isset ( $ packages [ $ link -> getSource ( ) ] ) ) { /** @var Link $package */ $ package = $ packages [ $ link -> getSource ( ) ] ; return new Link ( $ link -> getSource ( ) , $ link -> getTarget ( ) , $ vp -> parseConstraints ( $ package -> getConstraint ( ) -> getPrettyString ( ) ) , $ linkType [ 'description' ] , $ package -> getPrettyConstraint ( ) ) ; } return new Link ( $ link -> getSource ( ) , $ link -> getTarget ( ) , $ vp -> parseConstraints ( $ version ) , $ linkType [ 'description' ] , $ prettyVersion ) ; } return $ link ; } , $ links ) ; }
Update Links with a 'self.version' constraint with the root package's
version.

@param string $type Link type
@param array $links
@param RootPackageInterface $root
@return array
Update Links with a self . version constraint with the root package s version .