Skip to content

Commit

Permalink
Refactor array filter callbacks in Denormalizers
Browse files Browse the repository at this point in the history
This commit changes the array filter callbacks used in PublicKeyCredentialOptionsDenormalizer and PublicKeyCredentialUserEntityDenormalizer. The old and new conditions ensure that only values that aren't null pass through, whereas previous conditions also checked against empty arrays. The callbacks have also been updated to include return type declarations for better type safety.
  • Loading branch information
Spomky committed Jul 12, 2024
1 parent 82b8db9 commit 52a3dad
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,6 @@ public function normalize(mixed $data, ?string $format = null, array $context =
];
}

return array_filter($json, static fn ($value) => $value !== null && $value !== []);
return array_filter($json, static fn ($value): bool => $value !== null);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function normalize(mixed $data, ?string $format = null, array $context =
'icon' => $data->icon,
];

return array_filter($normalized, fn ($value) => $value !== null);
return array_filter($normalized, static fn ($value): bool => $value !== null);
}

public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool
Expand Down

0 comments on commit 52a3dad

Please sign in to comment.