1.2.693. Mismatch Parameter And Type

When the name of the parameter contradicts the type of the parameter.

This is mostly semantics, so it will affect the coder and the auditor of the code. PHP is immune to those errors.

<?php

// There is a discrepancy between the typehint and the name of the variable
function foo(int $string) { }

// The parameter name is practising coding convention typehints
function bar(int $int) { }

?>

1.2.693.1. Connex PHP features

1.2.693.1.1. Suggestions

  • Synch the name of the parameter and the typehint.

1.2.693.1.2. Specs

Short name

Functions/MismatchParameterAndType

Rulesets

All, Changed Behavior, Semantics

Exakat since

2.1.8

PHP Version

All

Severity

Minor

Time To Fix

Quick (30 mins)

Precision

Very high

Available in

Entreprise Edition, Exakat Cloud