1.2.812. No Named Parameters

Named parameters were introduced in PHP 8.0. They introduce a strong coupling between the parameter names and the calling structure: changing the parameter name breaks the call.

To avoid this, case by base, PHP.watch introduced the no-named-parameters PHP doc commend, which allows method owners to signal that the calls should not use the named parameters.

This analysis explicit named parameters. Named parameters in arrays are still to do.

<?php

/**
  * no-named-parameters
  */
function goo($a) {}
goo(a:1); // This is forbidden

?>

1.2.812.1. Suggestions

  • Remove the name of the parameter; check the order of the parameters.

1.2.812.2. Specs

Short name

Attributes/NoNamedArguments

Rulesets

All

Exakat since

2.6.7

Severity

Minor

Time To Fix

Quick (30 mins)

Precision

High

Features

named-parameter

Available in

Entreprise Edition, Exakat Cloud