WordPress / WordPress/WordPress-Coding-Standards
Sniff to discourage use of number_format() and date() in output
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 2.8k
- Forks
- 521
- Avg merge
- 5d 20h
- Merged PRs (30d)
- 1
Description
WP has the number_format_i18n() and the date_i18n() functions which allow for localization of numbers and dates.
While the "normal" number_format(), date_format(), date(), gmdate(), gmstrftime() and strftime() all have their place in code, I believe that when used in combination with an output generating function, the WP functions should be encouraged (and the PHP ones discouraged).
Opinions ?
On that note, there is also a PHP money_format() function. I'm not aware of a WP equivalent. Anyone know of one ?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No file, test, or entry point is named. Start by reviewing existing sniffs and their tests to determine how output-generating calls are identified; done means the agreed sniff discourages the listed PHP formatting functions in that context while permitting valid non-output uses.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100