1.2.1201. Too Many Dereferencing

Linking too many properties and methods, one to the other.

This analysis counts both static calls and normal call; methods, properties and constants. It also takes into account arrays along the way.

The default limit of chaining methods and properties is set to 7 by default. Too many chained methods is harder to read.

<?php

// 9 chained calls.
$main->getA()->getB()->getC()->getD()->getE()->getF()->getG()->getH()->getI()->property;

?>

Name

Default

Type

Description

tooManyDereferencing

7

integer

Maximum number of dereferencing.

1.2.1201.1. Specs

Short name

Classes/TooManyDereferencing

Rulesets

All, Analyze, Changed Behavior

Exakat since

1.9.7

PHP Version

All

Severity

Minor

Time To Fix

Quick (30 mins)

Precision

Very high

Features

dereferencing

Available in

Entreprise Edition, Exakat Cloud