PhpStorm 2020.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');
Last modified: 5 June 2020