src/Composer/DependencyResolver/DefaultPolicy.php
protected function pruneRemoteAliases(Pool $pool, array $literals)
    {
        $hasLocalAlias = false;

        foreach ($literals as $literal) {
            $package = $pool->literalToPackage($literal);

            if ($package instanceof AliasPackage && $package->isRootPackageAlias()) {
                $hasLocalAlias = true;
                break;
            }
        }

        if (!$hasLocalAlias) {
            return $literals;
        }

        $selected = array();
        foreach ($literals as $literal) {
            $package = $pool->literalToPackage($literal);

            if ($package instanceof AliasPackage && $package->isRootPackageAlias()) {
                $selected[] = $literal;
            }
        }

        return $selected;
    }
protected function pruneRemoteAliases(Pool $pool, array $literals)
    {
        $hasLocalAlias = false;

        foreach ($literals as $literal) {
            $package = $pool->literalToPackage($literal);

            if ($package instanceof AliasPackage && $package->isRootPackageAlias()) {
                $hasLocalAlias = true;
                break;
            }
        }

        if (!$hasLocalAlias) {
            return $literals;
        }

        $selected = array();
        foreach ($literals as $literal) {
            $package = $pool->literalToPackage($literal);

            if ($package instanceof AliasPackage && $package->isRootPackageAlias()) {
                $selected[] = $literal;
            }
        }

        return $selected;
    }
protected function pruneRemoteAliases ( Pool $ pool , array $ literals ) { $ hasLocalAlias = false ; foreach ( $ literals as $ literal ) { $ package = $ pool -> literalToPackage ( $ literal ) ; if ( $ package instanceof AliasPackage && $ package -> isRootPackageAlias ( ) ) { $ hasLocalAlias = true ; break ; } } if ( ! $ hasLocalAlias ) { return $ literals ; } $ selected = array ( ) ; foreach ( $ literals as $ literal ) { $ package = $ pool -> literalToPackage ( $ literal ) ; if ( $ package instanceof AliasPackage && $ package -> isRootPackageAlias ( ) ) { $ selected [ ] = $ literal ; } } return $ selected ; }
Assumes that locally aliased (in root package requires) packages take priority over branch-alias ones

If no package is a local alias, nothing happens
Assumes that locally aliased ( in root package requires ) packages take priority over branch - alias ones