updated composer
This commit is contained in:
31
vendor/phar-io/version/CHANGELOG.md
vendored
31
vendor/phar-io/version/CHANGELOG.md
vendored
@@ -2,25 +2,52 @@
|
||||
|
||||
All notable changes to phar-io/version are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
|
||||
|
||||
## [3.1.0] - 2021-02-23
|
||||
|
||||
>### Changed
|
||||
|
||||
- Internal Refactoring
|
||||
- More scalar types
|
||||
|
||||
### Added
|
||||
|
||||
- [#24](https://github.com/phar-io/version/issues/24): `Version::getOriginalString()` added (Thanks @addshore)
|
||||
- Version constraints using the caret operator (`^`) now honor pre-1.0 releases, e.g. `^0.3` translates to `0.3.*`)
|
||||
- Various integration tests for version constraint processing
|
||||
|
||||
### Fixed
|
||||
|
||||
- [#23](https://github.com/phar-io/version/pull/23): Tilde operator without patch level
|
||||
|
||||
|
||||
|
||||
## [3.0.4] - 14.12.2020
|
||||
|
||||
### Fixed
|
||||
|
||||
- [#22](https://github.com/phar-io/version/pull/22): make dev suffix rank works for uppercase too
|
||||
|
||||
|
||||
## [3.0.3] - 30.11.2020
|
||||
|
||||
### Added
|
||||
|
||||
- Comparator method `Version::equals()` added
|
||||
|
||||
|
||||
## [3.0.2] - 27.06.2020
|
||||
|
||||
This release now supports PHP 7.2+ and PHP ^8.0. No other changes included.
|
||||
|
||||
|
||||
## [3.0.1] - 09.05.2020
|
||||
|
||||
__Potential BC Break Notice:__
|
||||
`Version::getVersionString()` no longer returns `v` prefixes in case the "input"
|
||||
string contained one. These are not part of the semver specs
|
||||
(see https://semver.org/#is-v123-a-semantic-version) and get stripped out.
|
||||
As of Version 3.1.0 `Version::getOriginalString()` can be used to still
|
||||
retrieve it as given.
|
||||
|
||||
### Changed
|
||||
|
||||
- Internal Refactoring
|
||||
@@ -51,6 +78,7 @@ This release now supports PHP 7.2+ and PHP ^8.0. No other changes included.
|
||||
- Versions without a pre-release suffix are now always considered greater
|
||||
than versions with a pre-release suffix. Example: `3.0.0 > 3.0.0-alpha.1`
|
||||
|
||||
|
||||
## [2.0.0] - 23.06.2018
|
||||
|
||||
Changes to public API:
|
||||
@@ -83,6 +111,7 @@ Changes to public API:
|
||||
a numeric suffix as seen in Debian packages are now supported.
|
||||
|
||||
|
||||
[3.1.0]: https://github.com/phar-io/version/compare/3.0.4...3.1.0
|
||||
[3.0.4]: https://github.com/phar-io/version/compare/3.0.3...3.0.4
|
||||
[3.0.3]: https://github.com/phar-io/version/compare/3.0.2...3.0.3
|
||||
[3.0.2]: https://github.com/phar-io/version/compare/3.0.1...3.0.2
|
||||
|
||||
15
vendor/phar-io/version/src/PreReleaseSuffix.php
vendored
15
vendor/phar-io/version/src/PreReleaseSuffix.php
vendored
@@ -22,7 +22,7 @@ class PreReleaseSuffix {
|
||||
/** @var int */
|
||||
private $number = 0;
|
||||
|
||||
/** @var string */
|
||||
/** @var string */
|
||||
private $full;
|
||||
|
||||
/**
|
||||
@@ -56,12 +56,9 @@ class PreReleaseSuffix {
|
||||
return $this->getNumber() > $suffix->getNumber();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
*/
|
||||
private function mapValueToScore($value): int {
|
||||
$value = strtolower($value);
|
||||
|
||||
private function mapValueToScore(string $value): int {
|
||||
$value = \strtolower($value);
|
||||
|
||||
if (\array_key_exists($value, self::valueScoreMap)) {
|
||||
return self::valueScoreMap[$value];
|
||||
}
|
||||
@@ -69,14 +66,14 @@ class PreReleaseSuffix {
|
||||
return 0;
|
||||
}
|
||||
|
||||
private function parseValue($value): void {
|
||||
private function parseValue(string $value): void {
|
||||
$regex = '/-?((dev|beta|b|rc|alpha|a|patch|p)\.?(\d*)).*$/i';
|
||||
|
||||
if (\preg_match($regex, $value, $matches) !== 1) {
|
||||
throw new InvalidPreReleaseSuffixException(\sprintf('Invalid label %s', $value));
|
||||
}
|
||||
|
||||
$this->full = $matches[1];
|
||||
$this->full = $matches[1];
|
||||
$this->value = $matches[2];
|
||||
|
||||
if ($matches[3] !== '') {
|
||||
|
||||
32
vendor/phar-io/version/src/Version.php
vendored
32
vendor/phar-io/version/src/Version.php
vendored
@@ -10,6 +10,9 @@
|
||||
namespace PharIo\Version;
|
||||
|
||||
class Version {
|
||||
/** @var string */
|
||||
private $originalVersionString;
|
||||
|
||||
/** @var VersionNumber */
|
||||
private $major;
|
||||
|
||||
@@ -19,26 +22,32 @@ class Version {
|
||||
/** @var VersionNumber */
|
||||
private $patch;
|
||||
|
||||
/** @var PreReleaseSuffix */
|
||||
/** @var null|PreReleaseSuffix */
|
||||
private $preReleaseSuffix;
|
||||
|
||||
/**
|
||||
* @param string $versionString
|
||||
*/
|
||||
public function __construct($versionString) {
|
||||
public function __construct(string $versionString) {
|
||||
$this->ensureVersionStringIsValid($versionString);
|
||||
$this->originalVersionString = $versionString;
|
||||
}
|
||||
|
||||
public function getPreReleaseSuffix(): PreReleaseSuffix {
|
||||
if ($this->preReleaseSuffix === null) {
|
||||
throw new NoPreReleaseSuffixException('No pre-release suffix set');
|
||||
}
|
||||
|
||||
return $this->preReleaseSuffix;
|
||||
}
|
||||
|
||||
public function getOriginalString(): string {
|
||||
return $this->originalVersionString;
|
||||
}
|
||||
|
||||
public function getVersionString(): string {
|
||||
$str = sprintf(
|
||||
$str = \sprintf(
|
||||
'%d.%d.%d',
|
||||
$this->getMajor()->getValue(),
|
||||
$this->getMinor()->getValue(),
|
||||
$this->getPatch()->getValue()
|
||||
$this->getMajor()->getValue() ?? 0,
|
||||
$this->getMinor()->getValue() ?? 0,
|
||||
$this->getPatch()->getValue() ?? 0
|
||||
);
|
||||
|
||||
if (!$this->hasPreReleaseSuffix()) {
|
||||
@@ -108,6 +117,11 @@ class Version {
|
||||
return $this->patch;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string[] $matches
|
||||
*
|
||||
* @throws InvalidPreReleaseSuffixException
|
||||
*/
|
||||
private function parseVersion(array $matches): void {
|
||||
$this->major = new VersionNumber((int)$matches['Major']);
|
||||
$this->minor = new VersionNumber((int)$matches['Minor']);
|
||||
|
||||
@@ -11,11 +11,9 @@ namespace PharIo\Version;
|
||||
|
||||
class VersionConstraintParser {
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @throws UnsupportedVersionConstraintException
|
||||
*/
|
||||
public function parse($value): VersionConstraint {
|
||||
public function parse(string $value): VersionConstraint {
|
||||
if (\strpos($value, '||') !== false) {
|
||||
return $this->handleOrGroup($value);
|
||||
}
|
||||
@@ -33,34 +31,31 @@ class VersionConstraintParser {
|
||||
return $this->handleCaretOperator($value);
|
||||
}
|
||||
|
||||
$version = new VersionConstraintValue($value);
|
||||
$constraint = new VersionConstraintValue($value);
|
||||
|
||||
if ($version->getMajor()->isAny()) {
|
||||
if ($constraint->getMajor()->isAny()) {
|
||||
return new AnyVersionConstraint();
|
||||
}
|
||||
|
||||
if ($version->getMinor()->isAny()) {
|
||||
if ($constraint->getMinor()->isAny()) {
|
||||
return new SpecificMajorVersionConstraint(
|
||||
$version->getVersionString(),
|
||||
$version->getMajor()->getValue()
|
||||
$constraint->getVersionString(),
|
||||
$constraint->getMajor()->getValue() ?? 0
|
||||
);
|
||||
}
|
||||
|
||||
if ($version->getPatch()->isAny()) {
|
||||
if ($constraint->getPatch()->isAny()) {
|
||||
return new SpecificMajorAndMinorVersionConstraint(
|
||||
$version->getVersionString(),
|
||||
$version->getMajor()->getValue(),
|
||||
$version->getMinor()->getValue()
|
||||
$constraint->getVersionString(),
|
||||
$constraint->getMajor()->getValue() ?? 0,
|
||||
$constraint->getMinor()->getValue() ?? 0
|
||||
);
|
||||
}
|
||||
|
||||
return new ExactVersionConstraint($version->getVersionString());
|
||||
return new ExactVersionConstraint($constraint->getVersionString());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
*/
|
||||
private function handleOrGroup($value): OrVersionConstraintGroup {
|
||||
private function handleOrGroup(string $value): OrVersionConstraintGroup {
|
||||
$constraints = [];
|
||||
|
||||
foreach (\explode('||', $value) as $groupSegment) {
|
||||
@@ -70,43 +65,51 @@ class VersionConstraintParser {
|
||||
return new OrVersionConstraintGroup($value, $constraints);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*/
|
||||
private function handleTildeOperator($value): AndVersionConstraintGroup {
|
||||
$version = new Version(\substr($value, 1));
|
||||
$constraints = [
|
||||
new GreaterThanOrEqualToVersionConstraint($value, $version)
|
||||
];
|
||||
private function handleTildeOperator(string $value): AndVersionConstraintGroup {
|
||||
$constraintValue = new VersionConstraintValue(\substr($value, 1));
|
||||
|
||||
if ($version->getPatch()->isAny()) {
|
||||
$constraints[] = new SpecificMajorVersionConstraint(
|
||||
$value,
|
||||
$version->getMajor()->getValue()
|
||||
);
|
||||
} else {
|
||||
$constraints[] = new SpecificMajorAndMinorVersionConstraint(
|
||||
$value,
|
||||
$version->getMajor()->getValue(),
|
||||
$version->getMinor()->getValue()
|
||||
);
|
||||
if ($constraintValue->getPatch()->isAny()) {
|
||||
return $this->handleCaretOperator($value);
|
||||
}
|
||||
|
||||
$constraints = [
|
||||
new GreaterThanOrEqualToVersionConstraint(
|
||||
$value,
|
||||
new Version(\substr($value, 1))
|
||||
),
|
||||
new SpecificMajorAndMinorVersionConstraint(
|
||||
$value,
|
||||
$constraintValue->getMajor()->getValue() ?? 0,
|
||||
$constraintValue->getMinor()->getValue() ?? 0
|
||||
)
|
||||
];
|
||||
|
||||
return new AndVersionConstraintGroup($value, $constraints);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*/
|
||||
private function handleCaretOperator($value): AndVersionConstraintGroup {
|
||||
$version = new Version(\substr($value, 1));
|
||||
private function handleCaretOperator(string $value): AndVersionConstraintGroup {
|
||||
$constraintValue = new VersionConstraintValue(\substr($value, 1));
|
||||
|
||||
$constraints = [
|
||||
new GreaterThanOrEqualToVersionConstraint($value, new Version(\substr($value, 1)))
|
||||
];
|
||||
|
||||
if ($constraintValue->getMajor()->getValue() === 0) {
|
||||
$constraints[] = new SpecificMajorAndMinorVersionConstraint(
|
||||
$value,
|
||||
$constraintValue->getMajor()->getValue() ?? 0,
|
||||
$constraintValue->getMinor()->getValue() ?? 0
|
||||
);
|
||||
} else {
|
||||
$constraints[] = new SpecificMajorVersionConstraint(
|
||||
$value,
|
||||
$constraintValue->getMajor()->getValue() ?? 0
|
||||
);
|
||||
}
|
||||
|
||||
return new AndVersionConstraintGroup(
|
||||
$value,
|
||||
[
|
||||
new GreaterThanOrEqualToVersionConstraint($value, $version),
|
||||
new SpecificMajorVersionConstraint($value, $version->getMajor()->getValue())
|
||||
]
|
||||
$constraints
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,10 +20,7 @@ class VersionConstraintValue {
|
||||
/** @var string */
|
||||
private $versionString = '';
|
||||
|
||||
/**
|
||||
* @param string $versionString
|
||||
*/
|
||||
public function __construct($versionString) {
|
||||
public function __construct(string $versionString) {
|
||||
$this->versionString = $versionString;
|
||||
|
||||
$this->parseVersion($versionString);
|
||||
@@ -53,10 +50,7 @@ class VersionConstraintValue {
|
||||
return $this->patch;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $versionString
|
||||
*/
|
||||
private function parseVersion($versionString): void {
|
||||
private function parseVersion(string $versionString): void {
|
||||
$this->extractBuildMetaData($versionString);
|
||||
$this->extractLabel($versionString);
|
||||
$this->stripPotentialVPrefix($versionString);
|
||||
@@ -71,27 +65,21 @@ class VersionConstraintValue {
|
||||
$this->patch = new VersionNumber($patchValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $versionString
|
||||
*/
|
||||
private function extractBuildMetaData(&$versionString): void {
|
||||
private function extractBuildMetaData(string &$versionString): void {
|
||||
if (\preg_match('/\+(.*)/', $versionString, $matches) === 1) {
|
||||
$this->buildMetaData = $matches[1];
|
||||
$versionString = \str_replace($matches[0], '', $versionString);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $versionString
|
||||
*/
|
||||
private function extractLabel(&$versionString): void {
|
||||
private function extractLabel(string &$versionString): void {
|
||||
if (\preg_match('/-(.*)/', $versionString, $matches) === 1) {
|
||||
$this->label = $matches[1];
|
||||
$versionString = \str_replace($matches[0], '', $versionString);
|
||||
}
|
||||
}
|
||||
|
||||
private function stripPotentialVPrefix(&$versionString): void {
|
||||
private function stripPotentialVPrefix(string &$versionString): void {
|
||||
if ($versionString[0] !== 'v') {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -13,10 +13,7 @@ class GreaterThanOrEqualToVersionConstraint extends AbstractVersionConstraint {
|
||||
/** @var Version */
|
||||
private $minimalVersion;
|
||||
|
||||
/**
|
||||
* @param string $originalValue
|
||||
*/
|
||||
public function __construct($originalValue, Version $minimalVersion) {
|
||||
public function __construct(string $originalValue, Version $minimalVersion) {
|
||||
parent::__construct($originalValue);
|
||||
|
||||
$this->minimalVersion = $minimalVersion;
|
||||
|
||||
@@ -11,17 +11,12 @@ namespace PharIo\Version;
|
||||
|
||||
class SpecificMajorAndMinorVersionConstraint extends AbstractVersionConstraint {
|
||||
/** @var int */
|
||||
private $major = 0;
|
||||
private $major;
|
||||
|
||||
/** @var int */
|
||||
private $minor = 0;
|
||||
private $minor;
|
||||
|
||||
/**
|
||||
* @param string $originalValue
|
||||
* @param int $major
|
||||
* @param int $minor
|
||||
*/
|
||||
public function __construct($originalValue, $major, $minor) {
|
||||
public function __construct(string $originalValue, int $major, int $minor) {
|
||||
parent::__construct($originalValue);
|
||||
|
||||
$this->major = $major;
|
||||
|
||||
@@ -11,13 +11,9 @@ namespace PharIo\Version;
|
||||
|
||||
class SpecificMajorVersionConstraint extends AbstractVersionConstraint {
|
||||
/** @var int */
|
||||
private $major = 0;
|
||||
private $major;
|
||||
|
||||
/**
|
||||
* @param string $originalValue
|
||||
* @param int $major
|
||||
*/
|
||||
public function __construct($originalValue, $major) {
|
||||
public function __construct(string $originalValue, int $major) {
|
||||
parent::__construct($originalValue);
|
||||
|
||||
$this->major = $major;
|
||||
|
||||
5
vendor/phar-io/version/src/exceptions/NoPreReleaseSuffixException.php
vendored
Normal file
5
vendor/phar-io/version/src/exceptions/NoPreReleaseSuffixException.php
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php declare(strict_types = 1);
|
||||
namespace PharIo\Version;
|
||||
|
||||
class NoPreReleaseSuffixException extends \Exception implements Exception {
|
||||
}
|
||||
Reference in New Issue
Block a user