Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Add support for PHP 7.2 #531

Merged
merged 1 commit into from
Apr 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,14 @@ branches:
- context: "Refactoring (7.4, locked)"
- context: "Security Analysis (7.4, locked)"
- context: "Static Code Analysis (7.4, locked)"
- context: "Tests (7.5.0, 7.2, highest)"
- context: "Tests (7.5.0, 7.2, lowest)"
- context: "Tests (7.5.0, 7.3, highest)"
- context: "Tests (7.5.0, 7.3, lowest)"
- context: "Tests (7.5.0, 7.4, highest)"
- context: "Tests (7.5.0, 7.4, lowest)"
- context: "Tests (8.5.19, 7.2, highest)"
- context: "Tests (8.5.19, 7.2, lowest)"
- context: "Tests (8.5.19, 7.3, highest)"
- context: "Tests (8.5.19, 7.3, lowest)"
- context: "Tests (8.5.19, 7.4, highest)"
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/integrate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@ jobs:
- "7.5.0"

php-version:
- "7.2"
- "7.3"
- "7.4"

Expand All @@ -468,6 +469,14 @@ jobs:
- "highest"

include:
- phpunit-version: "8.5.19"
php-version: "7.2"
dependencies: "lowest"

- phpunit-version: "8.5.19"
php-version: "7.2"
dependencies: "highest"

- phpunit-version: "8.5.19"
php-version: "7.3"
dependencies: "lowest"
Expand Down
2 changes: 1 addition & 1 deletion .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

$license->save();

$ruleSet = PhpCsFixer\Config\RuleSet\Php73::create()
$ruleSet = PhpCsFixer\Config\RuleSet\Php72::create()
->withHeader($license->header())
->withRules(PhpCsFixer\Config\Rules::fromArray([
'mb_str_functions' => false,
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

For a full diff see [`2.11.0...main`][2.11.0...main].

### Changed

- Added support for PHP 7.2 ([#531]), by [@localheinz]

## [`2.11.0`][2.11.0]

For a full diff see [`2.10.0...2.11.0`][2.10.0...2.11.0].
Expand Down Expand Up @@ -291,6 +295,7 @@ For a full diff see [`7afa59c...1.0.0`][7afa59c...1.0.0].
[#491]: https://github.com/ergebnis/phpunit-slow-test-detector/pull/491
[#494]: https://github.com/ergebnis/phpunit-slow-test-detector/pull/494
[#495]: https://github.com/ergebnis/phpunit-slow-test-detector/pull/495
[#531]: https://github.com/ergebnis/phpunit-slow-test-detector/pull/531

[@HypeMC]: https://github.com/HypeMC
[@localheinz]: https://github.com/localheinz
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"security": "https://github.com/ergebnis/phpunit-slow-test-detector/blob/main/.github/SECURITY.md"
},
"require": {
"php": "~7.3.0 || ~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0",
"php": "~7.2.0 || ~7.3.0 || ~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0",
"phpunit/phpunit": "^7.5.0 || ^8.5.19 || ^9.0.0 || ^10.0.0 || ^11.0.0"
},
"require-dev": {
Expand Down
4 changes: 2 additions & 2 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@
__DIR__ . '/test/',
]);

$rectorConfig->phpVersion(ValueObject\PhpVersion::PHP_73);
$rectorConfig->phpVersion(ValueObject\PhpVersion::PHP_72);
};
12 changes: 6 additions & 6 deletions src/Duration.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ public static function fromSecondsAndNanoseconds(
if ($maxNanoseconds < $nanoseconds) {
throw Exception\InvalidNanoseconds::notLessThanOrEqualTo(
$nanoseconds,
$maxNanoseconds,
$maxNanoseconds
);
}

return new self(
$seconds,
$nanoseconds,
$nanoseconds
);
}

Expand All @@ -78,14 +78,14 @@ public static function fromMilliseconds(int $milliseconds): self

$seconds = \intdiv(
$milliseconds,
1000,
1000
);

$nanoseconds = ($milliseconds - $seconds * 1000) * 1000000;

return new self(
$seconds,
$nanoseconds,
$nanoseconds
);
}

Expand All @@ -107,13 +107,13 @@ public function add(self $other): self
if (999999999 < $nanoseconds) {
return new self(
$seconds + 1,
$nanoseconds - 1000000000,
$nanoseconds - 1000000000
);
}

return new self(
$seconds,
$nanoseconds,
$nanoseconds
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Exception/InvalidCount.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static function notGreaterThanZero(int $value): self
{
return new self(\sprintf(
'Value should be greater than 0, but %d is not.',
$value,
$value
));
}
}
2 changes: 1 addition & 1 deletion src/Exception/InvalidMilliseconds.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static function notGreaterThanZero(int $value): self
{
return new self(\sprintf(
'Value should be greater than 0, but %d is not.',
$value,
$value
));
}
}
4 changes: 2 additions & 2 deletions src/Exception/InvalidNanoseconds.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static function notGreaterThanOrEqualToZero(int $value): self
{
return new self(\sprintf(
'Value should be greater than or equal to 0, but %d is not.',
$value,
$value
));
}

Expand All @@ -33,7 +33,7 @@ public static function notLessThanOrEqualTo(
return new self(\sprintf(
'Value should be less than or equal to %d, but %d is not.',
$two,
$one,
$one
));
}
}
4 changes: 2 additions & 2 deletions src/Exception/InvalidSeconds.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ public static function notGreaterThanZero(int $value): self
{
return new self(\sprintf(
'Value should be greater than 0, but %d is not.',
$value,
$value
));
}

public static function notGreaterThanOrEqualToZero(int $value): self
{
return new self(\sprintf(
'Value should be greater than or equal to 0, but %d is not.',
$value,
$value
));
}
}
2 changes: 1 addition & 1 deletion src/Exception/PhaseNotStarted.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static function fromPhaseIdentifier(PhaseIdentifier $phaseIdentifier): se
{
return new self(\sprintf(
'Phase identified by "%s" has not been started.',
$phaseIdentifier->toString(),
$phaseIdentifier->toString()
));
}
}
22 changes: 11 additions & 11 deletions src/Extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
} catch (\InvalidArgumentException $exception) {
throw new \RuntimeException(\sprintf(
'Unable to determine PHPUnit version from version series "%s".',
Runner\Version::series(),
Runner\Version::series()

Check warning on line 25 in src/Extension.php

View check run for this annotation

Codecov / codecov/patch

src/Extension.php#L25

Added line #L25 was not covered by tests
));
}

Expand Down Expand Up @@ -75,7 +75,7 @@
$this->reporter = new Reporter\DefaultReporter(
new Formatter\DefaultDurationFormatter(),
$maximumDuration,
$maximumCount,
$maximumCount

Check warning on line 78 in src/Extension.php

View check run for this annotation

Codecov / codecov/patch

src/Extension.php#L78

Added line #L78 was not covered by tests
);
}

Expand Down Expand Up @@ -105,7 +105,7 @@

$duration = Duration::fromSecondsAndNanoseconds(
$seconds,
$nanoseconds,
$nanoseconds

Check warning on line 108 in src/Extension.php

View check run for this annotation

Codecov / codecov/patch

src/Extension.php#L108

Added line #L108 was not covered by tests
);

$maximumDuration = $this->resolveMaximumDuration($test);
Expand All @@ -119,7 +119,7 @@
$slowTest = SlowTest::create(
$testIdentifier,
$duration,
$maximumDuration,
$maximumDuration

Check warning on line 122 in src/Extension.php

View check run for this annotation

Codecov / codecov/patch

src/Extension.php#L122

Added line #L122 was not covered by tests
);

$this->collector->collect($slowTest);
Expand Down Expand Up @@ -156,7 +156,7 @@
{
[$testClassName, $testMethodName] = \explode(
'::',
$test,
$test

Check warning on line 159 in src/Extension.php

View check run for this annotation

Codecov / codecov/patch

src/Extension.php#L159

Added line #L159 was not covered by tests
);

$annotations = [
Expand All @@ -166,7 +166,7 @@

$symbolAnnotations = Util\Test::parseTestMethodAnnotations(
$testClassName,
$testMethodName,
$testMethodName

Check warning on line 169 in src/Extension.php

View check run for this annotation

Codecov / codecov/patch

src/Extension.php#L169

Added line #L169 was not covered by tests
);

foreach ($annotations as $annotation) {
Expand Down Expand Up @@ -230,20 +230,20 @@
$reporter = new Reporter\DefaultReporter(
new Formatter\DefaultDurationFormatter(),
$maximumDuration,
$maximumCount,
$maximumCount

Check warning on line 233 in src/Extension.php

View check run for this annotation

Codecov / codecov/patch

src/Extension.php#L233

Added line #L233 was not covered by tests
);

$facade->registerSubscribers(
new Subscriber\Test\PreparationStartedSubscriber($timeKeeper),
new Subscriber\Test\FinishedSubscriber(
$maximumDuration,
$timeKeeper,
$collector,
$collector

Check warning on line 241 in src/Extension.php

View check run for this annotation

Codecov / codecov/patch

src/Extension.php#L241

Added line #L241 was not covered by tests
),
new Subscriber\TestRunner\ExecutionFinishedSubscriber(
$collector,
$reporter,
),
$reporter
)

Check warning on line 246 in src/Extension.php

View check run for this annotation

Codecov / codecov/patch

src/Extension.php#L245-L246

Added lines #L245 - L246 were not covered by tests
);
}
}
Expand All @@ -253,5 +253,5 @@

throw new \RuntimeException(\sprintf(
'Unable to select extension for PHPUnit version with version series "%s".',
Runner\Version::series(),
Runner\Version::series()

Check warning on line 256 in src/Extension.php

View check run for this annotation

Codecov / codecov/patch

src/Extension.php#L256

Added line #L256 was not covered by tests
));
6 changes: 3 additions & 3 deletions src/Formatter/DefaultDurationFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function format(Duration $duration): string
$hours,
$minutes,
$seconds,
$milliseconds,
$milliseconds
);
}

Expand All @@ -55,14 +55,14 @@ public function format(Duration $duration): string
'%d:%02d.%03d',
$minutes,
$seconds,
$milliseconds,
$milliseconds
);
}

return \sprintf(
'%d.%03d',
$seconds,
$milliseconds,
$milliseconds
);
}
}
2 changes: 1 addition & 1 deletion src/Phase.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public static function create(
$phaseIdentifier,
$startTime,
$stopTime,
$stopTime->duration($startTime),
$stopTime->duration($startTime)
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/PhaseStart.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public static function create(
): self {
return new self(
$phaseIdentifier,
$startTime,
$startTime
);
}

Expand Down