Too few arguments to function %s%s%s(), %d passed in %s on line %d and %s %d expected

Description

This error is emitted when the number of arguments to call a method or a function is not enough.

Without the required number of arguments at function call, the function cannot execute, as some variables would be missing.

This error covers situations where all the arguments are compulsory.

Example

<?php

function foo($a, $b) {}

foo(1);

?>

Literal Examples

  • Too few arguments to function foo(), 1 passed in file.php on line 5 and exactly 2 expected

Solutions

  • Add the missing arguments.

  • Add default values to the missing arguments.