src/Version/Version.php
public function compare(VersionInterface $version)
    {
        if ($this->getMajorVersion() < $version->getMajorVersion()) {
            return -1;
        } elseif ($this->getMajorVersion() > $version->getMajorVersion()) {
            return 1;
        } else {
            if ($this->getMinorVersion() < $version->getMinorVersion()) {
                return -1;
            } elseif ($this->getMinorVersion() > $version->getMinorVersion()) {
                return 1;
            } else {
                if ($this->getReleaseVersion() < $version->getReleaseVersion()) {
                    return -1;
                } elseif ($this->getReleaseVersion() > $version->getReleaseVersion()) {
                    return 1;
                } else {
                    return 0;
                }
            }
        }
    }
public function compare(VersionInterface $version)
    {
        if ($this->getMajorVersion() < $version->getMajorVersion()) {
            return -1;
        } elseif ($this->getMajorVersion() > $version->getMajorVersion()) {
            return 1;
        } else {
            if ($this->getMinorVersion() < $version->getMinorVersion()) {
                return -1;
            } elseif ($this->getMinorVersion() > $version->getMinorVersion()) {
                return 1;
            } else {
                if ($this->getReleaseVersion() < $version->getReleaseVersion()) {
                    return -1;
                } elseif ($this->getReleaseVersion() > $version->getReleaseVersion()) {
                    return 1;
                } else {
                    return 0;
                }
            }
        }
    }
Compare with another version

@param VersionInterface $version

@return int (-1,0,1)