1.2.1245. Undefined Enumcase

The enumeration case does not exists. It may also be a constant.

<?php

enum theEnum {
    case A; // an enum case

    // a constant
    const C = 1;
}

function foo(theEnum $a) {}

foo(theEnum::A);
foo(theEnum::C);

?>

1.2.1245.1. Specs

Short name

Enums/UndefinedEnumcase

Rulesets

All, Analyze, Class Review, IsExt, IsPHP, IsStub

Exakat since

2.3.6

PHP Version

With PHP 8.1 and more recent

Severity

Minor

Time To Fix

Quick (30 mins)

Precision

High

Features

enum, enum-case

Related rule

Unused Enumeration Case

Available in

Entreprise Edition, Exakat Cloud