Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Unknown named parameter $%s

Description

Named parameters are the parameters of the function, or method. Their actual name is the name of the variable, without the leading $ sign.

With named parameters, the case is important, just like with variables.

Example

<?php

    function foo($a, $b) {}

    foo(c: 1);

?>

Literal Examples

  • Unknown named parameter $c

Alternatives

  • Check the case of the parameter.
  • Check the signature of the method to see if that parameter actually exists.
  • Add the parameter to the method signature.
  • Remove the name in the method call, and rely on positional arguments.
  • Check the actual method definition: interfaces have precedence, then in the class hierarchy, it is the last defined method, in class or trait.