Skip to content

Refactor NumberFormatter::format() for improved readability#157

Merged
brtdv merged 2 commits intomasterfrom
refactor/number-formatter-cleanup
Jan 14, 2026
Merged

Refactor NumberFormatter::format() for improved readability#157
brtdv merged 2 commits intomasterfrom
refactor/number-formatter-cleanup

Conversation

@brtdv
Copy link
Copy Markdown
Contributor

@brtdv brtdv commented Jan 14, 2026

Summary

  • Apply consistent code formatting with multi-line function signature
  • Remove unnecessary is_float() conditional check
  • Clarify comment explaining locale decimal point usage
  • Use consistent double quotes for strings

Problem

The NumberFormatter::format() method had inconsistent formatting and contained an unnecessary is_float() check. The locale's decimal point is always needed when converting numbers to strings, regardless of whether the input is a float or not, because PHP's (string) cast uses the locale's decimal separator.

Solution

  • Simplified the decimal point detection by always using localeconv()
  • Applied consistent code style (multi-line signatures, double quotes)
  • Added a clearer comment explaining why locale detection is necessary

brtdv added 2 commits January 14, 2026 22:58
- Apply consistent code formatting (multi-line function signature)
- Remove unnecessary is_float() conditional check
- Clarify comment explaining locale decimal point usage
- Use consistent double quotes for strings
@brtdv brtdv merged commit fb3b237 into master Jan 14, 2026
5 checks passed
@brtdv brtdv deleted the refactor/number-formatter-cleanup branch January 14, 2026 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant