Skip to content

Commit

Permalink
#767: Remove unecassary array_values calls
Browse files Browse the repository at this point in the history
Infection detected that these were not needed
  • Loading branch information
bdsl committed May 19, 2024
1 parent a9cd256 commit b5cfc9b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/DetectChanges/BCBreak/EnumBased/CasesChanged.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ static function (ReflectionEnumCase $case) use ($fromEnum): bool {
},
);


$removedCases = array_filter(
$fromEnum->getCases(),
static function (ReflectionEnumCase $case) use ($toEnum): bool {
Expand All @@ -50,23 +51,23 @@ static function (ReflectionEnumCase $case) use ($toEnum): bool {
},
);

$caseRemovedChanges = array_values(array_map(
$caseRemovedChanges = array_map(
static function (ReflectionEnumCase $case) use ($fromEnumName): Change {
$caseName = $case->getName();

return Change::removed('Case ' . $fromEnumName . '::' . $caseName . ' was removed');
},
$removedCases,
));
);

$caseAddedChanges = array_values(array_map(
$caseAddedChanges = array_map(
static function (ReflectionEnumCase $case) use ($fromEnumName): Change {
$caseName = $case->getName();

return Change::added('Case ' . $fromEnumName . '::' . $caseName . ' was added');
},
$addedCases,
));
);

return Changes::fromList(...$caseRemovedChanges, ...$caseAddedChanges);
}
Expand Down

0 comments on commit b5cfc9b

Please sign in to comment.