Case %s::%s does not exist

Description

This error is reported by the Reflection API, when trying to generate the informational object ReflectionEnumUnitCase, with a non-existing Case.

Example

<?php

enum E {
    case a;
}

$reflectionEnum = new ReflectionEnum(E::class);
$reflectionEnum->getCase('b');


?>

Literal Examples

  • Case E::b does not exist

Solutions

  • Make sure the case exists before trying to instantiate its relate object.