1.2.690. 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.690.1. Suggestions

  • Synch the name of the parameter and the typehint.

1.2.690.2. Specs

Short name

Functions/MismatchParameterAndType

Rulesets

All, Semantics

Exakat since

2.1.8

PHP Version

All

Severity

Minor

Time To Fix

Quick (30 mins)

Precision

Very high

Features

parameter, type, semantics

Available in

Entreprise Edition, Exakat Cloud