lib/VersionComparator.php
public static function compareVersionRange($version, $range)
    {

        if ($range == '' || $version == '') {
            return true;
        }

        if (is_string($version)) {
            $v1 = Parser::parse($version);
        }
        else {
            $v1 = $version;
        }

        if ($v1->toString(true, false) == $range) {
            return true;
        }

        $expression = self::compileRange($range);

        return $expression->compare($v1);
    }
public static function compareVersionRange($version, $range)
    {

        if ($range == '' || $version == '') {
            return true;
        }

        if (is_string($version)) {
            $v1 = Parser::parse($version);
        }
        else {
            $v1 = $version;
        }

        if ($v1->toString(true, false) == $range) {
            return true;
        }

        $expression = self::compileRange($range);

        return $expression->compare($v1);
    }
public static function compareVersionRange ( $ version , $ range ) { if ( $ range == '' || $ version == '' ) { return true ; } if ( is_string ( $ version ) ) { $ v1 = Parser :: parse ( $ version ) ; } else { $ v1 = $ version ; } if ( $ v1 -> toString ( true , false ) == $ range ) { return true ; } $ expression = self :: compileRange ( $ range ) ; return $ expression -> compare ( $ v1 ) ; }
Compare a version with a given range.

It does not compare with secondary version.

@param string|Version $version a version number
@param string $range   a version expression respecting Composer range syntax

@return bool true if the given version match the given range
Compare a version with a given range .