Add documentation for __serialize and __unserialize

master 3.0.0
Julien Rosset 2 years ago
parent 6c69b5504b
commit 4f299bdde3

@ -168,11 +168,23 @@ class ImmutableCollection implements IImmutableCollection {
throw new ImmutableException(); throw new ImmutableException();
} }
/**
* List of properties to {@see https://www.php.net/manual/function.serialize.php serialize}
*
* @return array[] List of properties to {@see https://www.php.net/manual/function.serialize.php serialize}
*/
public function __serialize (): array { public function __serialize (): array {
return [ return [
'elements' => $this->elements, 'elements' => $this->elements,
]; ];
} }
/**
* {@see https://www.php.net/manual/function.unserialize.php Unserialize} from the list of serialized properties
*
* @param array $data The list of serialized properties
*
* @return void
*/
public function __unserialize (array $data): void { public function __unserialize (array $data): void {
$this->_initialize($data['elements']); $this->_initialize($data['elements']);
} }

Loading…
Cancel
Save