1.2.332. Defined Class Constants

Checks if class constants are defined. This includes class constants, one level of parent (extended) or interfaces (implemented).

This analysis takes into account native PHP, extension and stubs class definitions.

<?php

class X {
    const Y = 2;

    function foo() {
        // This is defined on the line above
        echo self::Y;

        // This is not defined in the current code
        echo X::X;
    }
}

?>

1.2.332.1. Specs

Short name

Classes/DefinedConstants

Rulesets

All, CE, IsExt, IsPHP, IsStub

Exakat since

0.8.4

PHP Version

All

Severity

Time To Fix

Precision

Very high

Features

class-constant

Available in

Entreprise Edition, Community Edition, Exakat Cloud