upgrade to laravel 7 and set branch to v2

This commit is contained in:
2020-12-25 11:22:15 +00:00
parent 516105c492
commit 0ddd298350
4638 changed files with 132501 additions and 190226 deletions
+12 -22
View File
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types = 1);
/*
* This file is part of PharIo\Version.
*
@@ -7,26 +7,22 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PharIo\Version;
class VersionConstraintParser {
/**
* @param string $value
*
* @return VersionConstraint
*
* @throws UnsupportedVersionConstraintException
*/
public function parse($value) {
if (strpos($value, '||') !== false) {
public function parse($value): VersionConstraint {
if (\strpos($value, '||') !== false) {
return $this->handleOrGroup($value);
}
if (!preg_match('/^[\^~\*]?[\d.\*]+(?:-.*)?$/', $value)) {
if (!\preg_match('/^[\^~*]?v?[\d.*]+(?:-.*)?$/i', $value)) {
throw new UnsupportedVersionConstraintException(
sprintf('Version constraint %s is not supported.', $value)
\sprintf('Version constraint %s is not supported.', $value)
);
}
@@ -63,14 +59,12 @@ class VersionConstraintParser {
/**
* @param $value
*
* @return OrVersionConstraintGroup
*/
private function handleOrGroup($value) {
private function handleOrGroup($value): OrVersionConstraintGroup {
$constraints = [];
foreach (explode('||', $value) as $groupSegment) {
$constraints[] = $this->parse(trim($groupSegment));
foreach (\explode('||', $value) as $groupSegment) {
$constraints[] = $this->parse(\trim($groupSegment));
}
return new OrVersionConstraintGroup($value, $constraints);
@@ -78,11 +72,9 @@ class VersionConstraintParser {
/**
* @param string $value
*
* @return AndVersionConstraintGroup
*/
private function handleTildeOperator($value) {
$version = new Version(substr($value, 1));
private function handleTildeOperator($value): AndVersionConstraintGroup {
$version = new Version(\substr($value, 1));
$constraints = [
new GreaterThanOrEqualToVersionConstraint($value, $version)
];
@@ -105,11 +97,9 @@ class VersionConstraintParser {
/**
* @param string $value
*
* @return AndVersionConstraintGroup
*/
private function handleCaretOperator($value) {
$version = new Version(substr($value, 1));
private function handleCaretOperator($value): AndVersionConstraintGroup {
$version = new Version(\substr($value, 1));
return new AndVersionConstraintGroup(
$value,