Skip to content

Commit

Permalink
Fix: Simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz committed Dec 3, 2023
1 parent 1ecacf8 commit 313c6c7
Show file tree
Hide file tree
Showing 11 changed files with 689 additions and 4,202 deletions.
5 changes: 1 addition & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,8 @@
"ergebnis/composer-normalize": "^2.28.3",
"ergebnis/data-provider": "^3.2.0",
"ergebnis/license": "^2.4.0",
"ergebnis/php-cs-fixer-config": "^6.13.0",
"fakerphp/faker": "^1.23.0",
"psalm/plugin-phpunit": "~0.18.4",
"rector/rector": "~0.18.11",
"vimeo/psalm": "^5.16.0"
"rector/rector": "~0.18.11"
},
"autoload": {
"psr-4": {
Expand Down
3,780 changes: 425 additions & 3,355 deletions composer.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/Extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
use PHPUnit\Util;

try {
$phpUnitVersion = Version\Version::fromString(Runner\Version::id());
$phpUnitVersionSeries = Version\Series::fromString(Runner\Version::id());
} catch (\InvalidArgumentException $exception) {
throw new \RuntimeException(\sprintf(
'Unable to determine PHPUnit version from version identifier "%s".',
Runner\Version::id(),
));
}

if ($phpUnitVersion->major()->equals(Version\Major::fromInt(9))) {
if ($phpUnitVersionSeries->major()->equals(Version\Major::fromInt(9))) {
/**
* @internal
*/
Expand Down Expand Up @@ -166,7 +166,7 @@ private function resolveMaximumDuration(string $test): Duration
return $this->maximumDuration;
}
}
} elseif ($phpUnitVersion->major()->equals(Version\Major::fromInt(10))) {
} elseif ($phpUnitVersionSeries->major()->equals(Version\Major::fromInt(10))) {
/**
* @internal
*/
Expand Down
47 changes: 0 additions & 47 deletions src/Version/Minor.php

This file was deleted.

47 changes: 0 additions & 47 deletions src/Version/Patch.php

This file was deleted.

54 changes: 54 additions & 0 deletions src/Version/Series.php
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;
}
}
183 changes: 0 additions & 183 deletions src/Version/Version.php

This file was deleted.

Loading

0 comments on commit 313c6c7

Please sign in to comment.