Skip to content

Commit d458075

Browse files
committed
Raising minimum coverage threshold again
Squished some mutants in between: the reason why mutants were uncovered is that closures were not being covered at all. Replacing the closures with PHP 8.1 short closure declarations fixes this, working around the coverage issue.
1 parent 435cfad commit d458075

6 files changed

+50
-38
lines changed

infection.json.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212
"mutators": {
1313
"@default": true
1414
},
15-
"minMsi": 95.4,
15+
"minMsi": 98,
1616
"minCoveredMsi": 100
1717
}

src/Changelog/ChangelogReleaseNotes.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ public function merge(self $next): self
5858
{
5959
if ($this->changelogEntry && $next->changelogEntry) {
6060
throw new RuntimeException(
61-
'Aborting: Both current release notes and next contain a ChangelogEntry;'
62-
. ' only one CreateReleaseText implementation should resolve one.',
61+
'Aborting: Both current release notes and next contain a ChangelogEntry; only one CreateReleaseText implementation should resolve one.',
6362
);
6463
}
6564

src/Git/Value/MergeTargetCandidateBranches.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ public static function fromAllBranches(BranchName ...$branches): self
2626
return $branch->isReleaseBranch();
2727
});
2828

29-
$mergeTargetBranches = Vec\sort($mergeTargetBranches, static function (BranchName $a, BranchName $b): int {
30-
return $a->majorAndMinor() <=> $b->majorAndMinor();
31-
});
29+
$mergeTargetBranches = Vec\sort($mergeTargetBranches, self::branchOrder(...));
3230

3331
return new self($mergeTargetBranches);
3432
}
@@ -98,4 +96,10 @@ public function contains(BranchName $needle): bool
9896
static fn (BranchName $branch): bool => $needle->equals($branch)
9997
);
10098
}
99+
100+
/** @return -1|0|1 */
101+
private static function branchOrder(BranchName $a, BranchName $b): int
102+
{
103+
return $a->majorAndMinor() <=> $b->majorAndMinor();
104+
}
101105
}

src/Github/CreateReleaseTextViaKeepAChangelog.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -130,17 +130,20 @@ private function updateReleaseDate(string $changelog, string $version): string
130130
*/
131131
private function removeDefaultContents(string $changelog): string
132132
{
133-
$contents = Iter\reduce(
133+
return Type\non_empty_string()->assert(Iter\reduce(
134134
self::DEFAULT_SECTIONS,
135-
static fn (string $changelog, string $section): string => Regex\replace(
136-
$changelog,
137-
"/\n\#{3} " . $section . "\n\n- Nothing.\n/s",
138-
'',
139-
),
135+
self::removeEmptyDefaultChangelogSection(...),
140136
$changelog,
141-
);
137+
));
138+
}
142139

143-
return Type\non_empty_string()->assert($contents);
140+
private static function removeEmptyDefaultChangelogSection(string $changelog, string $section): string
141+
{
142+
return Regex\replace(
143+
$changelog,
144+
"/\n\#{3} " . $section . "\n\n- Nothing.\n/s",
145+
'',
146+
);
144147
}
145148

146149
/**

src/Monolog/ConvertLogContextHttpRequestsIntoStrings.php

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,23 @@ public function __invoke(LogRecord $record): LogRecord
2020
$record->channel,
2121
$record->level,
2222
$record->message,
23-
array_map(static function ($item): mixed {
24-
if (! $item instanceof RequestInterface) {
25-
return $item;
26-
}
27-
28-
return $item->getMethod()
29-
. ' '
30-
. $item
31-
->getUri()
32-
->withUserInfo('')
33-
->__toString();
34-
}, $record->context),
23+
array_map(self::contextItemToMessage(...), $record->context),
3524
$record->extra,
3625
$record->formatted,
3726
);
3827
}
28+
29+
private static function contextItemToMessage(mixed $item): mixed
30+
{
31+
if (! $item instanceof RequestInterface) {
32+
return $item;
33+
}
34+
35+
return $item->getMethod()
36+
. ' '
37+
. $item
38+
->getUri()
39+
->withUserInfo('')
40+
->__toString();
41+
}
3942
}

src/Monolog/ConvertLogContextHttpResponsesIntoStrings.php

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,23 @@ public function __invoke(LogRecord $record): LogRecord
2020
$record->channel,
2121
$record->level,
2222
$record->message,
23-
array_map(static function ($item): mixed {
24-
if (! $item instanceof ResponseInterface) {
25-
return $item;
26-
}
27-
28-
return $item->getStatusCode()
29-
. ' "'
30-
. $item
31-
->getBody()
32-
->__toString()
33-
. '"';
34-
}, $record->context),
23+
array_map(self::contextItemToMessage(...), $record->context),
3524
$record->extra,
3625
$record->formatted,
3726
);
3827
}
28+
29+
private static function contextItemToMessage(mixed $item): mixed
30+
{
31+
if (! $item instanceof ResponseInterface) {
32+
return $item;
33+
}
34+
35+
return $item->getStatusCode()
36+
. ' "'
37+
. $item
38+
->getBody()
39+
->__toString()
40+
. '"';
41+
}
3942
}

0 commit comments

Comments
 (0)