Description

Consider three PHP files A.phpB.php and C.php . A.php contains a class namely "ClassA" which is instantiated in files "B.php" and "C.php". Considering this as reference between the files ; violation of metric Avoid unreferenced PHP Files (PHP) is false violation.

This is not a false violation.

Applicable in CAST Version
Release
Yes/No
8.3.x(tick)
Details

In PHP, if one wants to initialize a class (in this case ClassA), which is defined in other file (in this case A.php), one should include/require that file in the target file (in this case B.php/C.php).

include 'filename';
 OR
require 'filename';

In this example in A.php there is no include/require for the file "B.php" or "C.php" and that is why there is no link between the two files, hence there is a violation which is not a false violation.

Notes / Comments


Related Pages