Skip to content

Conversation

@albozek
Copy link
Contributor

@albozek albozek commented Dec 12, 2025

🎫 Issue IBX-10902

Related PRs:

Description:

For QA:

Documentation:

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR ensures that the Badge component only displays non-negative values by normalizing any negative input to zero. This change prevents badges from showing negative numbers, which would be semantically incorrect for this UI component.

Key Changes:

  • Added normalization to the value property in the Badge component to clamp negative values to 0

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

->allowedTypes('int')
->required();
->required()
->normalize(static fn(OptionsResolver $options, int $value): int => max(0, $value));
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The normalization silently converts negative values to 0, which may hide bugs in calling code. Consider adding validation to reject negative values with a clear error message, or document this behavior explicitly if silent normalization is intentional.

Suggested change
->normalize(static fn(OptionsResolver $options, int $value): int => max(0, $value));
->allowedValues(static fn(int $value): bool => $value >= 0);

Copilot uses AI. Check for mistakes.
@albozek albozek requested a review from mikadamczyk December 16, 2025 08:12
@albozek albozek closed this Dec 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant