Trying to clone an uncloneable object of class %s

Description

It is not possible to instantiate an enumeration. It is also not possible to clone its cases. The only usage is to access the cases of the enumeration: they are directly the expected objects.

Example

<?php

enum E {
    case A;
}

clone E::A;

?>

Literal Examples

  • Trying to clone an uncloneable object of class e

Solutions

  • Use the case E::A (don’t mistake it with a class constant).