phan / phan/phan

Support * variable width in PrintfCheckerPlugin, warn about compatibility for older minimum_target_php_version

Open
#4,330 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement help wanted php8
Dominant language
PHP
Stars
5.6k
Forks
365
Avg merge
1h 25m
Merged PRs (30d)
6

Description

<?php
// PhanPluginPrintfNoSpecifiers None of the formatting arguments passed alongside format string "%.*f\n" are used
printf("%.*f\n", 2, M_PI);  // 3.14 in php 8.0, 'f' in php 7.4

printf() and friends now support using "*" as width or precision, in which case the width/precision is passed as an argument to printf. This also allows using precision -1 with %g, %G, %h and %H. For example, the following code can be used to reproduce PHP's default floating point formatting:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating PrintfCheckerPlugin and its existing handling of printf format arguments, then inspect how minimum_target_php_version compatibility warnings are represented. Reproduce the shown %.*f behavior on supported PHP versions and add coverage for variable width or precision and the older-target warning; done means valid uses are no longer reported as unused arguments.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.