Enums are not compatible with %s

Description

It is not possible to use an object as backing for the arrayobject class. Enums cases are objects, of the type of the enum. Hence, this is not possible.

Example

<?php

enum Foo {
    case Bar;
}

new ArrayObject(Foo::Bar);

?>

Solutions

  • Put the value of the case in an array.

Changed Behavior

This error may appear following an evolution in behavior, in previous versions. See ` <https://php-changed-behaviors.readthedocs.io/en/latest/behavior/.html>`_.