File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -106,6 +106,25 @@ public function __wakeup()
106106 }
107107 }
108108
109+ /**
110+ * This method exists only for the compatibility reason when deserializing a previously serialized version
111+ * that didn't have the key property.
112+ *
113+ * @param array $data Data to unserialize from.
114+ * @psalm-param array $data
115+ */
116+ public function __unserialize (array $ data ): void
117+ {
118+ /** @psalm-suppress DocblockTypeContradiction key can be null when deserializing an enum without the key */
119+ if ($ this ->key === null ) {
120+ /**
121+ * @psalm-suppress InaccessibleProperty key is not readonly as marked by psalm
122+ * @psalm-suppress PossiblyFalsePropertyAssignmentValue deserializing a case that was removed
123+ */
124+ $ this ->key = static ::search ($ this ->value );
125+ }
126+ }
127+
109128 /**
110129 * Create a new enum instance from a value.
111130 *
You can’t perform that action at this time.
0 commit comments