PhpStorm 2021.1 Help

Code Inspection: Format function parameters mismatch

Reports the parameters and specification conversion entries that are passed as the format function's arguments but are not mapped to any entries.

  • In the following example, the sprintf() call contains two conversion specifications, %d and %s, but is provided three parameters. The last parameter $foo is therefore not mapped to any conversion specification:

    sprintf('There are %d monkeys in the %s', 5, 'tree', $foo);
  • In the following example, the sprintf() call contains three conversion specifications, %d, %s, and %s, but is only provided two parameters. The last conversion specification %s is therefore not mapped to any parameter:

    sprintf('There are %d %s in the %s', 5, 'tree');

Suppress an inspection in the editor

  1. Position the caret at the highlighted line and press Alt+Enter or click the Intention action icon.

  2. Click the arrow next to the inspection you want to suppress and select the necessary suppress action.

Last modified: 08 March 2021