MIR0719
EnumInstantiation
An enum is used with new. Enum instances are its cases; PHP throws Cannot instantiate enum for new Suit(), also for new self() or new static() inside the enum.
Example
Section titled “Example”<?phpenum Suit { case Hearts; case Spades;}
$suit = new Suit(); // cannot instantiate enumHow to fix
Section titled “How to fix”Use a case, or look one up by value on a backed enum:
<?php$suit = Suit::Hearts;