PHPCompatibility / PHPCompatibility/PHPCompatibility
PHP 8.0: `*printf()` and related functions support new specifiers
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 2.3k
- Forks
- 201
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 42
Description
Is your feature request related to a problem?
PHP 8.0 silently introduced two new placeholder characters for the *printf() range of functions.
This not mentioned in migration guide, changelog etc - I only discovered it by accident via a small note in the manual.
h | Like the g specifier but uses F. Available as of PHP 8.0.0.
H | Like the g specifier but uses E and F. Available as of PHP 8.0.0.
Ref: https://www.php.net/manual/en/function.sprintf.php
Describe the solution you'd like
New sniff in the ParameterValue category to analyze the $format parameter of the relevant functions and flag use of the new modifiers if PHP < 8.0 needs to be supported.
- I intend to create a pull request to implement this feature.
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
Start by locating the ParameterValue category and the existing handling for the *printf() family, then trace how the $format parameter and PHP-version conditions are represented. Done means a new sniff flags the h and H specifiers when compatibility with PHP versions before 8.0 is required, with coverage in the project’s relevant test suite.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100