mirror of
https://github.com/macintoshplus/mongo-php-driver.git
synced 2026-04-23 08:28:01 +02:00
594cad9a30
Revert previous enum instantiation behavior and PersistableEnum trait from de5f1e5a93
Backed enums will be encoded as their case value. Non-backed cannot be encoded and no enums can be encoded at the root level.
Prohibit enums from implementing Persistable and Unserializable.
21 lines
448 B
PHP
21 lines
448 B
PHP
--TEST--
|
|
Enum cannot implement Unserializable
|
|
--SKIPIF--
|
|
<?php require __DIR__ . "/../utils/basic-skipif.inc"; ?>
|
|
<?php skip_if_php_version('<', '8.1.0'); ?>
|
|
--FILE--
|
|
<?php
|
|
|
|
enum MyEnum implements MongoDB\BSON\Unserializable
|
|
{
|
|
case A;
|
|
|
|
public function bsonUnserialize(array $data): void {}
|
|
}
|
|
|
|
?>
|
|
===DONE===
|
|
<?php exit(0); ?>
|
|
--EXPECTF--
|
|
Fatal error: Enum class MyEnum cannot implement interface MongoDB\BSON\Unserializable in %s on line %d
|