Skip to content

Commit

Permalink
Remove array keys from the field collection as they're not used anywh…
Browse files Browse the repository at this point in the history
…ere and add complexity without value

They are only expected in a single test file and never actually used. They also don't offer any new information since the name is present within the value.
  • Loading branch information
caendesilva committed Jan 8, 2023
1 parent d1f5d53 commit d9be7cb
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,8 @@ protected function getPublicationsSortedByPaginationField(): Collection

protected function parseFieldData(array $fields): Collection
{
// FIXME check if we actually need the named key, as that adds complexity and the need to call ->values()
return Collection::make($fields)->mapWithKeys(function (array $data): array {
return [$data['name'] => new PublicationFieldDefinition(...$data)];
return Collection::make($fields)->map(function (array $data): PublicationFieldDefinition {
return new PublicationFieldDefinition(...$data);
});
}

Expand Down

0 comments on commit d9be7cb

Please sign in to comment.