PHPCompatibility / PHPCompatibility

PHP Compatibility check for PHP_CodeSniffer

Home Page:http://techblog.wimgodden.be/tag/codesniffer/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PHP 8.0: `*printf()` and related functions support new specifiers

jrfnl opened this issue · comments

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.