generated from ergebnis/php-package-template
-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1ecacf8
commit 313c6c7
Showing
11 changed files
with
689 additions
and
4,202 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* Copyright (c) 2021-2023 Andreas Möller | ||
* | ||
* For the full copyright and license information, please view | ||
* the LICENSE.md file that was distributed with this source code. | ||
* | ||
* @see https://github.com/ergebnis/phpunit-slow-test-detector | ||
*/ | ||
|
||
namespace Ergebnis\PHPUnit\SlowTestDetector\Version; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
final class Series | ||
{ | ||
private Major $major; | ||
|
||
private function __construct(Major $major) | ||
{ | ||
$this->major = $major; | ||
} | ||
|
||
public static function create(Major $major): self | ||
{ | ||
return new self($major); | ||
} | ||
|
||
/** | ||
* @throws \InvalidArgumentException | ||
*/ | ||
public static function fromString(string $value): self | ||
{ | ||
if (0 === \preg_match('/^(?P<major>(0|[1-9]\d*))\.(?P<minor>(0|[1-9]\d*))?$/', $value, $matches)) { | ||
throw new \InvalidArgumentException(\sprintf( | ||
'Value "%s" does not appear to be a valid value for a semantic version.', | ||
$value, | ||
)); | ||
} | ||
|
||
$major = Major::fromInt((int) $matches['major']); | ||
|
||
return self::create($major); | ||
} | ||
|
||
public function major(): Major | ||
{ | ||
return $this->major; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.