<commit_before><?php

/*
 * This file is part of Composer.
 *
 * (c) <NAME> <<EMAIL>>
 *     <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Composer\DependencyResolver;

use Composer\Repository\RepositoryInterface;
use Composer\Package\PackageInterface;

/**
 * @author <NAME> <<EMAIL>>
 */
class DefaultPolicy implements PolicyInterface
{
    public function allowUninstall()
    {
        return false;
    }

    public function allowDowngrade()
    {
        return false;
    }

    public function versionCompare(PackageInterface $a, PackageInterface $b, $operator)
    {
        return version_compare($a->getVersion(), $b->getVersion(), $operator);
    }

    public function findUpdatePackages(Solver $solver, Pool $pool, RepositoryInterface $repo, PackageInterface $package, $allowAll = false)
    {
        $packages = array();

        foreach ($pool->whatProvides($package->getName()) as $candidate) {
            // skip old packages unless downgrades are an option
            if (!$allowAll && !$this->allowDowngrade() && $this->versionCompare($package, $candidate, '>')) {
                continue;
            }

            if ($candidate != $package) {
                $packages[] = $candidate;
            }
        }
<commit_msg>In the default policy compare object ids to avoid recursion.<commit_after><?php

/*
 * This file is part of Composer.
 *
 * (c) <NAME> <<EMAIL>>
 *     <NAME> <<EMAIL>>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Composer\DependencyResolver;

use Composer\Repository\RepositoryInterface;
use Composer\Package\PackageInterface;

/**
 * @author <NAME> <<EMAIL>>
 */
class DefaultPolicy implements PolicyInterface
{
    public function allowUninstall()
    {
        return false;
    }

    public function allowDowngrade()
    {
        return false;
    }

    public function versionCompare(PackageInterface $a, PackageInterface $b, $operator)
    {
        return version_compare($a->getVersion(), $b->getVersion(), $operator);
    }

    public function findUpdatePackages(Solver $solver, Pool $pool, RepositoryInterface $repo, PackageInterface $package, $allowAll = false)
    {
        $packages = array();

        foreach ($pool->whatProvides($package->getName()) as $candidate) {
            // skip old packages unless downgrades are an option
            if (!$allowAll && !$this->allowDowngrade() && $this->versionCompare($package, $candidate, '>')) {
                continue;
            }

            if ($candidate !== $package) {
                $packages[] = $candidate;
            }
        }

{'fraction_non_alphanumeric': 0.12158273381294964, 'fraction_numerical': 0.0, 'mean_word_length': 2.783673469387755, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6264994', 'n_tokens_mistral': 745, 'n_tokens_neox': 733, 'n_words': 213}