1.2.386. Duplicate Named Parameter

Two parameters have the same name in a method call. This will yield a Fatal error at execution time.

<?php

function foo($a, $b) {}

// parameters are all distinct
foo(a:1, b:2);

// parameter a is double
foo(a:1, a:1);

?>

See also Function arguments.

1.2.386.1. Suggestions

  • Review the parameters names and remove the duplicates

  • Review the parameters names and makes the names unique

1.2.386.2. Specs

Short name

Functions/DuplicateNamedParameter

Rulesets

All, Analyze, Changed Behavior, LintButWontExec

Exakat since

2.2.3

PHP Version

With PHP 7.0 and older

Severity

Minor

Time To Fix

Quick (30 mins)

Precision

Very high

Features

named-parameter

Note

This issue may lint but will not run

Available in

Entreprise Edition, Exakat Cloud