Why This Happens
PHP 8.0 introduced named arguments, but the names must exactly match the parameter names in the function definition. This error occurs when there is a typo, the parameter was renamed, or you are using the wrong name for a built-in function's parameter.
The Problem
function createButton(string $label, string $color = 'blue'): string {
return "<button style='color:$color'>$label</button>";
}
echo createButton(label: 'Click', colour: 'red'); // 'colour' not 'color'The Fix
function createButton(string $label, string $color = 'blue'): string {
return "<button style='color:$color'>$label</button>";
}
echo createButton(label: 'Click', color: 'red');Step-by-Step Fix
- 1
Check the parameter name
Compare the named argument in your call with the actual parameter name in the function definition. Look for spelling differences.
- 2
Verify the function signature
Check the function or method definition, including inherited or interface methods, to see the exact parameter names.
- 3
Fix the argument name
Correct the named argument to match the parameter name exactly.
Got the actual stack trace?
Paste it into our free AI explainer to get the cause and the fix for your specific case — no signup, nothing to install.
Explain my errorBugsly catches this automatically
Bugsly's AI analyzes this error pattern in real-time, explains what went wrong in plain English, and suggests the exact fix — before your users even report it.
Try Bugsly free